# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
565649 | 2022-05-21T08:11:21 Z | almothana05 | Election (BOI18_election) | C++14 | 3000 ms | 920 KB |
#include<bits/stdc++.h> #define mod 1000000007 ////////////////////////////////////////////////////////// #define inf 100000000000000000 using namespace std; int num[300000]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int menge , numm , nummer , que; string s; cin >> menge >> s; cin >> que; int erg; while(que--){ erg = 0; cin >> numm >> nummer; numm--; nummer--; int t = 0 , c = 0; for(int i = numm ; i <= nummer ; i++){ if(s[i] == 'T'){ t++; } else{ c++; } if(t > c){ num[i] = 1; erg++; t--; } } t = 0; c = 0; for(int i = nummer; i >= numm ; i--){ if(num[i] == 1){ continue; } if(s[i] == 'T'){ t++; } else{ c++; } if(t > c){ num[i] = 1; erg++; t--; } } cout << erg << "\n"; for(int i = 0 ; i < s.size() ; i++){ num[i] = 0; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 9 ms | 340 KB | Output is correct |
3 | Correct | 8 ms | 340 KB | Output is correct |
4 | Correct | 7 ms | 212 KB | Output is correct |
5 | Correct | 4 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 9 ms | 340 KB | Output is correct |
3 | Correct | 8 ms | 340 KB | Output is correct |
4 | Correct | 7 ms | 212 KB | Output is correct |
5 | Correct | 4 ms | 340 KB | Output is correct |
6 | Execution timed out | 3062 ms | 920 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 9 ms | 340 KB | Output is correct |
3 | Correct | 8 ms | 340 KB | Output is correct |
4 | Correct | 7 ms | 212 KB | Output is correct |
5 | Correct | 4 ms | 340 KB | Output is correct |
6 | Execution timed out | 3062 ms | 920 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |