Submission #878473

#TimeUsernameProblemLanguageResultExecution timeMemory
878473phoenix0423Modern Machine (JOI23_ho_t5)C++17
3 / 100
3053 ms1372 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pll; #define fastio ios::sync_with_stdio(false), cin.tie(0) #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(x) (x).begin(), (x).end() #define pb push_back #define eb emplace_back #define f first #define s second const int INF = 1e9; const int maxn = 2e5 + 5; int main(void){ fastio; int n, m; cin>>n>>m; vector<int> org(n), c(n); string s; cin>>s; REP(i, n) { org[i] = (s[i] == 'R'); } vector<int> a(m); REP(i, m) cin>>a[i], a[i] --; auto play = [&](int pos) -> void{ c[pos] = 1; while(pos >= 0 && pos < n){ c[pos] ^= 1; if(c[pos]) pos--; else pos++; } }; int q; cin>>q; while(q--){ int l, r; cin>>l>>r; l--, r--; c = org; for(int i = l; i <= r; i++) play(a[i]); int cnt = 0; REP(i, n) if(c[i]) cnt++; cout<<cnt<<"\n"; } }
#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...