# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
934373 | vjudge1 | Street Lamps (APIO19_street_lamps) | C++17 | 91 ms | 12264 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 1000000007
#define INF 1000000000
#define INF2 2000000000000000000
//#define ll long long
///#define cin fin
///#define cout fout
using namespace std;
double const EPS = 1e-14;
///ofstream fout("herding.out");
///ifstream fin("herding.in");
int main()
{
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
int n, q; cin >> n >> q;
string s; cin >> s; int siz = s.size();
int arr[siz], sum[siz] = {}, last[siz] = {};
for(int i = 0; i < s.size(); i++) {
arr[i] = s[i]-'0';
}
int cnt = 1;
while(q--) {
string ty; cin >> ty;
if(ty == "toggle") {
int x; cin >> x;
sum[x-1] += (cnt-last[x-1])*arr[x-1];
last[x-1] = cnt;
arr[x-1] = abs(1-arr[x-1]);
}
else {
int a, b; cin >> a >> b;
sum[a-1] += (cnt-last[a-1])*arr[a-1];
last[a-1] = cnt;
cout << sum[a-1] << endl;
}
cnt++;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |