답안 #433720

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
433720 2021-06-20T09:55:42 Z Mounir 가로등 (APIO19_street_lamps) C++14
20 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>
#define chmax(x, v) x = max(x, v)
#define pii pair<int, int>
#define pb push_back
#define all(x) x.begin(), x.end()
#define chmin(x, v) x = min(x, v)
#define sz(x) (int)x.size()
#define int long long
using namespace std;


signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int nVals, nReqs; cin >> nVals >> nReqs;
	vector<int> vals(nVals);
	string chaine; cin >> chaine;

	for (int iVal = 0; iVal < nVals; ++iVal)
		vals[iVal] = (chaine[iVal] - '0');
	vector<vector<int>> etats;
	etats.pb(vals);
	for (int iReq = 0; iReq < nReqs; ++iReq){
		string typeReq; cin >> typeReq;
		if (typeReq == "toggle"){
			int ind; cin >> ind;
			vals[ind - 1] ^= 1;
		}
		else {
			int sum = 0, a, b; cin >> a >> b;
			--a; --b;
			for (int inst = 0; inst <= iReq; ++inst){
				bool ok = true;
				for (int ind = a; ind < b; ++ind)
					ok &= (etats[inst][ind] == 1);
				sum += ok;
			}
			cout << sum << endl;
		}
		etats.pb(vals);
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5054 ms 30964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8140 KB Output is correct
2 Correct 64 ms 8096 KB Output is correct
3 Correct 129 ms 8192 KB Output is correct
4 Correct 164 ms 8096 KB Output is correct
5 Runtime error 282 ms 524292 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 212 ms 8132 KB Output is correct
2 Correct 205 ms 8120 KB Output is correct
3 Correct 101 ms 8204 KB Output is correct
4 Correct 15 ms 8140 KB Output is correct
5 Runtime error 261 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 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Execution timed out 5054 ms 30964 KB Time limit exceeded
9 Halted 0 ms 0 KB -