user4698
0
Q:

sfere numerate problema olinfo

#include<bits/stdc++.h>
using namespace std;

vector<int> sphere;
void inizio(int N,int M, int sfere[]){
	for (int i = 0; i < N; i++)
		sphere.push_back(sfere[i]);
}
void modifica(int posizione,int valore){
	sphere[posizione] = valore;
}
bool verifica(int l,int r){
	set<int> v;
	int K = (r - l) + 1;
	
	for(int i = 0; i < K; i++) v.insert(sphere[l + i]);

	set<int>::iterator 	lastIt = v.end();
	lastIt--;
if(*lastIt == K && v.size() == K) 
		return true; 
	else 
		return false;
}
0

New to Communities?

Join the community