| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1203235 | Johan | Election (BOI18_election) | C++20 | 3095 ms | 1072 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, q;
string s;
cin >> n >> s >> q;
s = '#' + s;
while(q--){
int l, r;
cin >> l >> r;
string ss = s;
int C = 0, T = 0, tot = 0;
for(int i = l; i <= r; i++){
C += (s[i] == 'C');
T += (s[i] == 'T');
if(T > C) s[i] = '#', T--, tot++;
}
C = T = 0;
for(int i = r; i >= l; i--){
C += (s[i] == 'C');
T += (s[i] == 'T');
if(T > C) s[i] = '#', T--, tot++;
}
cout << tot << endl;
s = ss;
}
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
