| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 848189 | KN200711 | Election (BOI18_election) | C++14 | 9 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
# define fi first
# define se second
using namespace std;
int main() {
int N;
string S;
cin>>N;
cin>>S;
int Q;
cin>>Q;
for(int tc = 1;tc<=Q;tc++) {
int a, b;
cin>>a>>b;
if(a > b) swap(a, b);
a--;
b--;
int c = 0, d = 0, e = 0;
for(int i=a;i<=b;i++) {
if(S[i] == 'T') {
if(c == 0) d++;
else c--;
} else c++;
}
c = 0;
for(int i=b;i>=a;i--) {
if(S[i] == 'T') {
if(c == 0) e++;
else c--;
} else c++;
}
printf("%d\n", max(d, e));
}
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
