# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61897 | 2018-07-27T04:43:17 Z | 김현수(#2139) | parentrises (BOI18_parentrises) | C++11 | 72 ms | 5656 KB |
#include<bits/stdc++.h> using namespace std; const int N = 2000005; int n; char a[N], b[N]; void solve1 () { scanf("%s",a+1); n = strlen(a+1); queue<int> X, Y, Q; int A = 0, B = 0, C = 0, D = 0; for(int i=1;i<=n;i++) { if(a[i] == '(') { if(D < C) { D++; B++; b[i] = 'R'; Y.push(i); } else { C++; A++; b[i] = 'B'; X.push(i); } } else { A--; B--; b[i] = 'G'; Q.push(i); } while(A < 0 && !Y.empty()) { int T = Y.front(); Y.pop(); b[T] = 'G'; A++; } while(B < 0 && !X.empty()) { int T = X.front(); X.pop(); b[T] = 'G'; B++; } while(A < 0 && !Q.empty()) { int T = Q.front(); Q.pop(); b[T] = 'R'; A++; } while(B < 0 && !Q.empty()) { int T = Q.front(); Q.pop(); b[T] = 'B'; B++; } if(A < 0 || B < 0) { puts("impossible"); return; } } if(A > 0 || B > 0) { puts("impossible"); return; } b[n+1] = 0; printf("%s\n",b+1); } void solve2() { } int main() { int typ, tc; scanf("%d%d",&typ,&tc); while(tc--) { if(typ == 1) solve1(); else solve2(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 520 KB | Output is correct |
4 | Correct | 4 ms | 600 KB | Output is correct |
5 | Correct | 3 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 652 KB | Output is correct |
2 | Correct | 2 ms | 652 KB | Output is correct |
3 | Correct | 2 ms | 652 KB | Output is correct |
4 | Correct | 3 ms | 652 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 652 KB | Output is correct |
2 | Correct | 2 ms | 652 KB | Output is correct |
3 | Correct | 2 ms | 652 KB | Output is correct |
4 | Correct | 3 ms | 652 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
6 | Correct | 3 ms | 652 KB | Output is correct |
7 | Correct | 2 ms | 652 KB | Output is correct |
8 | Correct | 3 ms | 652 KB | Output is correct |
9 | Correct | 3 ms | 652 KB | Output is correct |
10 | Correct | 3 ms | 652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 652 KB | Output is correct |
2 | Correct | 2 ms | 652 KB | Output is correct |
3 | Correct | 2 ms | 652 KB | Output is correct |
4 | Correct | 3 ms | 652 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
6 | Correct | 3 ms | 652 KB | Output is correct |
7 | Correct | 2 ms | 652 KB | Output is correct |
8 | Correct | 3 ms | 652 KB | Output is correct |
9 | Correct | 3 ms | 652 KB | Output is correct |
10 | Correct | 3 ms | 652 KB | Output is correct |
11 | Correct | 5 ms | 652 KB | Output is correct |
12 | Correct | 3 ms | 652 KB | Output is correct |
13 | Correct | 2 ms | 736 KB | Output is correct |
14 | Correct | 3 ms | 736 KB | Output is correct |
15 | Correct | 2 ms | 736 KB | Output is correct |
16 | Correct | 10 ms | 736 KB | Output is correct |
17 | Correct | 5 ms | 1048 KB | Output is correct |
18 | Correct | 3 ms | 1048 KB | Output is correct |
19 | Correct | 5 ms | 1048 KB | Output is correct |
20 | Correct | 6 ms | 1048 KB | Output is correct |
21 | Correct | 72 ms | 1304 KB | Output is correct |
22 | Correct | 28 ms | 5656 KB | Output is correct |
23 | Correct | 19 ms | 5656 KB | Output is correct |
24 | Correct | 25 ms | 5656 KB | Output is correct |
25 | Correct | 31 ms | 5656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 5656 KB | Unexpected end of file - int32 expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 5656 KB | Unexpected end of file - int32 expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 5656 KB | Unexpected end of file - int32 expected |