Submission #139589

# Submission time Handle Problem Language Result Execution time Memory
139589 2019-08-01T06:34:26 Z FedericoS Street Lamps (APIO19_street_lamps) C++14
20 / 100
307 ms 5752 KB
#include <iostream>
using namespace std;

bool sub2=true;

int N,Q;
char c;
string s;
int A[300005],B[300005];
bool T[105][105];

int main(){
	cin>>N>>Q;
	for(int i=0;i<N;i++){
		cin>>c;
		B[i]=(c=='1');
		T[0][i]=B[i];
	}

	for(int i=0;i<Q;i++){
		cin>>s;
		if(s=="query"){
			cin>>A[i]>>B[i];
			A[i]--;
			B[i]--;
			if(B[i]-A[i]!=1)
				sub2=false;
		}
		else{
			cin>>A[i];
			A[i]--;
			B[i]=-1;
		}
	}

	if(N<=100 and Q<=100){
		for(int i=0;i<Q;i++){
			if(B[i]==-1)
				T[i+1][A[i]]=true;
			else{
				int ans=0;
				for(int k=0;k<i+1;k++){
					bool flag=true;
					for(int j=A[i];j<B[i];j++)
						flag&=T[k][j];
					ans+=flag;
				}
				cout<<ans<<"\n";
			}
			for(int j=0;j<N;j++)
				T[i+1][j]^=T[i][j];
		}
	}

	/*for(int i=0;i<Q;i++){
		for(int j=0;j<N;j++)
			cout<<T[i][j]<<" ";
		cout<<endl;
	}*/
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 307 ms 5752 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 307 ms 5752 KB Output isn't correct
9 Halted 0 ms 0 KB -