| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 404110 | Hazem | Street Lamps (APIO19_street_lamps) | C++14 | 393 ms | 4820 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define F first
#define S second
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
const int N = 3e5+10;
const int M = 200;
const LL INF = 1e9;
const LL LINF = 2e18;
const LL MOD = 1e9+7;
const double PI = 3.141592653589793;
int ans[N],last[N];
int main(){
//freopen("out.txt","w",stdout);
int n,q;
scanf("%d%d",&n,&q);
string s;cin>>s;
for(int i=0;i<n;i++)
if(s[i]=='0')
last[i] = -1;
for(int t = 1;t<=q;t++){
string s1;cin>>s1;
if(s1[0]=='q'){
int l,r;
scanf("%d%d",&l,&r);
l--,r--;
printf("%d\n",ans[l]+(last[l]==-1?0:t-last[l]));
}
else {
int x;scanf("%d",&x);x--;
if(s[x]=='0')
s[x] = '1',last[x] = t;
else
ans[x] += t-last[x],last[x] = -1;
}
}
}
컴파일 시 표준 에러 (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... | ||||
