답안 #834283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
834283 2023-08-22T12:36:59 Z Antekb 가로등 (APIO19_street_lamps) C++17
20 / 100
5000 ms 2408 KB
#include<bits/stdc++.h>
#define st first
#define nd second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define pp pop_back
#define mp make_pair
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vii = vector<pii>;
void debug(){cerr<<"\n";}
template<typename H, typename... T>
void debug(H h, T... t){
	cerr<<h;
	if(sizeof...(t)){
		cerr<<", ";
	}
	debug(t...);
}
#define deb(x...) cerr<<#x<<" = ";debug(x);

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N=1<<9;
int co[N][N];
int main(){
	int n, q;
	cin>>n>>q;
	string s;
	cin>>s;
	for(int i=0; i<n; i++){
		co[i][0]=(s[i]-'0');
	}
	for(int qq=1; qq<=q; qq++){
		for(int i=0; i<n; i++){
			co[i][qq]=co[i][qq-1];
		}
		cin>>s;
		if(s[0]=='q'){
			//deb(qq);
			int a, b;
			cin>>a>>b;
			a--;
			b--;
			int ans=0;
			for(int t=0; t<qq; t++){
				bool c=1;
				for(int i=a; i<b; i++){
					if(!co[i][t]){
						c=0;
						break;
					}
				}
				if(c)ans++;
			}
			cout<<ans<<"\n";
		}
		else{
			int v;
			cin>>v;
			v--;
			co[v][qq]^=1;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 440 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5063 ms 1404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 2388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 2408 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 440 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Execution timed out 5063 ms 1404 KB Time limit exceeded
9 Halted 0 ms 0 KB -