Submission #207901

# Submission time Handle Problem Language Result Execution time Memory
207901 2020-03-09T11:43:28 Z Segtree Street Lamps (APIO19_street_lamps) C++14
0 / 100
553 ms 3064 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x.begin(),x.end()
#define N 300010
ll n,q;
ll tim[N],pnt[N],flag[N];
int main(){
	cin>>n>>q;
	string s;
	cin>>s;
	rep(i,n){
		tim[i]=0,pnt[i]=0,flag[i]=(s[i]=='1');
	}
	rep(i,q){
		string typ;
		cin>>typ;
		if(typ=="toggle"){
			ll x; cin>>x;
			x--;
			pnt[x]+=flag[i]*(i-tim[x]);
			tim[x]=i;
			flag[i]^=1;
		}
		else{
			ll x,b; cin>>x>>b;
			x--;
			pnt[x]+=flag[i]*(i-tim[x]);
			tim[x]=i;
			cout<<pnt[x]<<endl;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 553 ms 3064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Incorrect 6 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -