| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 404954 | A_D | 가로등 (APIO19_street_lamps) | C++14 | 745 ms | 11312 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define ii pair<int,int>
#define F first
#define S second
#define du long double
using namespace std;
const int N=3e5+100;
int a[N];
int ans[N];
void solve()
{
int n,q;
cin>>n>>q;
string s;
cin>>s;
int cnt=0;
for(auto x:s){
cnt++;
if(x=='1'){
a[cnt]=0;
}
else{
a[cnt]=-1;
}
}
for(int i=1;i<=q;i++){
// for(int j=1;j<=n;j++)cout<<a[j]<<" ";cout<<endl;
// for(int j=1;j<=n;j++)cout<<ans[j]<<" ";cout<<endl;
string s;
cin>>s;
if(s=="query"||s=="1"){
int b;
scanf("%lld",&b);
scanf("%lld",&b);
b--;
int u=ans[b];
if(a[b]!=-1){
u+=i-a[b];
}
printf("%lld\n",u);
}
else{
int b;
scanf("%lld",&b);
if(a[b]==-1){
a[b]=i;
}
else{
ans[b]+=i-a[b];
a[b]=-1;
}
}
}
}
main()
{
int t=1;
//cin>>t;
while(t--)solve();
}
컴파일 시 표준 에러 (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... | ||||
