Submission #1096558

#TimeUsernameProblemLanguageResultExecution timeMemory
1096558AbitoModern Machine (JOI23_ho_t5)C++17
15 / 100
77 ms604 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define ll long long typedef unsigned long long ull; using namespace std; const int N=7005; int n,m,q,a[N],p[N]; bool b[N]; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n>>m; for (int i=1;i<=n;i++){ char c;cin>>c; if (c=='R') b[i]=1; } for (int i=1;i<=m;i++) cin>>a[i]; cin>>q; int s,e; cin>>s>>e; for (int i=s;i<=e;i++){ b[a[i]]=1; int L=a[i],R=a[i]; bool h=1; while (L && R<=n){ if (h){ while (b[R+1]==1) R++; //cout<<L<<' '<<R<<endl; p[L]++; p[R+1]--; R++; h=!h; } else{ while (b[L-1]==0 && L>1) L--; //cout<<L<<' '<<R<<endl; p[L]++; p[R+1]--; L--; h=!h; } } for (int j=1;j<=n;j++){ p[j]+=p[j-1]; if (p[j]%2) b[j]^=1; } for (int j=1;j<=n;j++) p[j]=0; } int ans=0; for (int i=1;i<=n;i++) ans+=b[i]; cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...