# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404954 | 2021-05-15T11:49:23 Z | A_D | Street Lamps (APIO19_street_lamps) | C++14 | 745 ms | 11312 KB |
#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(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 400 ms | 1108 KB | Output is correct |
2 | Correct | 419 ms | 4828 KB | Output is correct |
3 | Correct | 409 ms | 5216 KB | Output is correct |
4 | Correct | 443 ms | 11312 KB | Output is correct |
5 | Correct | 492 ms | 9280 KB | Output is correct |
6 | Correct | 384 ms | 11100 KB | Output is correct |
7 | Correct | 726 ms | 9680 KB | Output is correct |
8 | Correct | 745 ms | 10924 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |