답안 #410273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
410273 2021-05-22T11:51:03 Z etaha 가로등 (APIO19_street_lamps) C++14
20 / 100
5000 ms 524292 KB
//debug icin gdb kullanmayi dene
#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define rs resize
#define pii pair<lint,lint> 
#define piii pair<lint,pair<lint,lint> > 
#define inf LLONG_MAX-7
#define vvL vector<vector<lint> > 
#define vvB vector<vector<bool> > 
#define vvvL vector<vector<vector<lint> > > 
#define vL vector<lint> 
#define vpii vector<pii> 
#define vB vector<bool> 
typedef long long int lint;
typedef unsigned long long int ulint;
lint fastpow(lint tab,lint us){
	if(tab==0) return 0;
	if(tab==1) return 1;
	if(us==0) return 1;
	if(us==1) return tab%mods;
	tab%=mods;
	if(us%2==1) return tab*fastpow(tab,us-1)%mods;
	lint a=fastpow(tab,us/2)%mods;
	return a*a%mods;
}
lint t=1,n,q;
vector<string> tum;
void solve(){
	lint i,j,a,b,k;
	cin>>n>>q;
	string s,str;
	cin>>s;
//	cez.rs(n+5,0);
//	mev.rs(n+5,-1);
	tum.rs(q+5);
	tum[0]=s;
//	for(i=1;i<=n;i++) if(s[i-1]=='0') mev[i]=0;
	for(j=1;j<=q;j++){
		cin>>str;
		if(str=="query"){
			cin>>a>>b;
			a--,b--;
			lint ret=0;
			for(i=0;i<j;i++){
				for(k=a;k<b;k++) if(tum[i][k]=='0') break;
				if(k==b) ret++;
			}
			cout<<ret<<endl;
			tum[j]=tum[j-1];
		}else{
			cin>>a;
			a--;
			s=tum[j-1];
			if(s[a]=='0') s[a]='1';
			else s[a]='0';
			tum[j]=s;
		}

	}


	return;
}

int main(){
//	freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//	cin>>t;
	while(t--) solve();
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5043 ms 16932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1228 KB Output is correct
2 Correct 3 ms 1356 KB Output is correct
3 Correct 4 ms 1280 KB Output is correct
4 Correct 100 ms 1376 KB Output is correct
5 Runtime error 240 ms 524292 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1228 KB Output is correct
2 Correct 5 ms 1228 KB Output is correct
3 Correct 4 ms 1356 KB Output is correct
4 Correct 2 ms 1356 KB Output is correct
5 Runtime error 217 ms 524292 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Execution timed out 5043 ms 16932 KB Time limit exceeded
9 Halted 0 ms 0 KB -