제출 #536283

#제출 시각아이디문제언어결과실행 시간메모리
536283DeepessonElection (BOI18_election)C++17
28 / 100
3082 ms640 KiB
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); int N; std::cin>>N; std::string s; std::cin >> s; int Q; std::cin>>Q; for(int i=0;i!=Q;++i){ int l,r; std::cin>>l>>r;--l;--r; std::string nov = s; int s=0; int ans=0; for(int j=l;j!=r+1;++j){ if(nov[j]=='C')++s;else if(nov[j]=='T'){ --s; if(s<0){ ++s; ++ans; nov[j]='N'; } } } s=0; for(int j=r;j!=l-1;--j){ if(nov[j]=='C')++s;else if(nov[j]=='T'){ --s; if(s<0){ ++s; ++ans; nov[j]='N'; } } } std::cout<<ans<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...