# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
417675 | 2021-06-04T06:21:20 Z | 장태환(#7548) | Parking Problem (innopolis2021_final_A) | C++17 | 96 ms | 916 KB |
#include <bits/stdc++.h> using namespace std; int main() { int T; ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> T; while(T--) { string a,b; cin >> a >> b ; int i; int c=0; priority_queue<int>oo,ee; for(i=0;i<a.size();i++) { if(a[i]=='X') { if(c>1) { if(c%2) ee.push(c-1); else oo.push(c-1); } c=0; } else c++; } if(c>1) { if(c%2) ee.push(c-1); else oo.push(c-1); } int s=0,en=b.size()+1; while(s!=en) { priority_queue<int>o,e; o=oo; e=ee; int m=(s+en)/2; int three=0,two=0; for(i=0;i<m;i++) { if(b[i]=='M') two++; else three++; } for(i=0;i<three+two;i++) { if(i<two) { if(e.size()) { if(e.top()>2) e.push(e.top()-2); e.pop(); } else if(o.size()) { if(o.top()>2) o.push(o.top()-2); o.pop(); } } else { if(o.size()) { if(o.top()>3) e.push(o.top()-3); o.pop(); } else if(e.size()) { if(e.top()>3) o.push(e.top()-3); e.pop(); } } } if(e.size()||o.size()) s=m+1; else en=m; } for(i=0;i<s;i++) cout <<'Y'; for(i=s;i<=b.size();i++) cout <<'N'; cout <<'\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 708 KB | Output is correct |
2 | Correct | 25 ms | 468 KB | Output is correct |
3 | Correct | 43 ms | 580 KB | Output is correct |
4 | Correct | 50 ms | 768 KB | Output is correct |
5 | Correct | 26 ms | 588 KB | Output is correct |
6 | Correct | 48 ms | 916 KB | Output is correct |
7 | Correct | 31 ms | 500 KB | Output is correct |
8 | Correct | 46 ms | 660 KB | Output is correct |
9 | Correct | 35 ms | 708 KB | Output is correct |
10 | Correct | 25 ms | 524 KB | Output is correct |
11 | Correct | 48 ms | 660 KB | Output is correct |
12 | Correct | 28 ms | 724 KB | Output is correct |
13 | Correct | 22 ms | 460 KB | Output is correct |
14 | Correct | 44 ms | 580 KB | Output is correct |
15 | Correct | 34 ms | 472 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 816 KB | Output is correct |
2 | Correct | 27 ms | 460 KB | Output is correct |
3 | Correct | 47 ms | 572 KB | Output is correct |
4 | Incorrect | 46 ms | 780 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 96 ms | 796 KB | Output is correct |
2 | Correct | 69 ms | 720 KB | Output is correct |
3 | Correct | 42 ms | 556 KB | Output is correct |
4 | Correct | 34 ms | 540 KB | Output is correct |
5 | Correct | 35 ms | 460 KB | Output is correct |
6 | Correct | 38 ms | 580 KB | Output is correct |
7 | Correct | 43 ms | 624 KB | Output is correct |
8 | Correct | 59 ms | 580 KB | Output is correct |
9 | Correct | 32 ms | 544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 708 KB | Output is correct |
2 | Correct | 25 ms | 468 KB | Output is correct |
3 | Correct | 43 ms | 580 KB | Output is correct |
4 | Correct | 50 ms | 768 KB | Output is correct |
5 | Correct | 26 ms | 588 KB | Output is correct |
6 | Correct | 48 ms | 916 KB | Output is correct |
7 | Correct | 31 ms | 500 KB | Output is correct |
8 | Correct | 46 ms | 660 KB | Output is correct |
9 | Correct | 35 ms | 708 KB | Output is correct |
10 | Correct | 25 ms | 524 KB | Output is correct |
11 | Correct | 48 ms | 660 KB | Output is correct |
12 | Correct | 28 ms | 724 KB | Output is correct |
13 | Correct | 22 ms | 460 KB | Output is correct |
14 | Correct | 44 ms | 580 KB | Output is correct |
15 | Correct | 34 ms | 472 KB | Output is correct |
16 | Correct | 49 ms | 816 KB | Output is correct |
17 | Correct | 27 ms | 460 KB | Output is correct |
18 | Correct | 47 ms | 572 KB | Output is correct |
19 | Incorrect | 46 ms | 780 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |