# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
417654 | 2021-06-04T06:01:37 Z | 조영욱(#7641) | Parking Problem (innopolis2021_final_A) | C++17 | 233 ms | 924 KB |
#include <bits/stdc++.h> using namespace std; int n,m; char str[100001]; char str2[100001]; typedef pair<int,int> P; bool isp(int k) { int row=0; priority_queue<P> pq; for(int i=0;i<n;i++) { if (str[i]=='X') { if (row>1) { pq.push(P((row-1)%3,row-1)); } row=0; } else { row++; } } if (row>1) pq.push(P((row-1)%3,row-1)); int two=0; int three=0; for(int i=0;i<k;i++) { if (str2[i]=='C') { three++; } else { two++; } } for(int i=0;i<two;i++) { if (pq.empty()) { break; } P now=pq.top(); pq.pop(); now.second-=2; if (now.second>0) { pq.push(P(now.second%3,now.second)); } } int sum=0; while (!pq.empty()) { sum+=(pq.top().second+2)/3; pq.pop(); } return sum<=three; } int main(void) { int tc; scanf("%d",&tc); for(int t=0;t<tc;t++) { scanf("%s",str); scanf("%s",str2); n=strlen(str); m=strlen(str2); int lo=-1; //impossible int hi=m+1; //possible while (lo+1<hi) { int mid=(lo+hi)/2; if (isp(mid)) { hi=mid; } else { lo=mid; } } for(int i=0;i<=m;i++) { if (i<hi) { printf("Y"); } else { printf("N"); } } printf("\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 580 KB | Output is correct |
2 | Correct | 35 ms | 464 KB | Output is correct |
3 | Correct | 45 ms | 588 KB | Output is correct |
4 | Correct | 83 ms | 724 KB | Output is correct |
5 | Correct | 35 ms | 460 KB | Output is correct |
6 | Correct | 81 ms | 712 KB | Output is correct |
7 | Correct | 41 ms | 472 KB | Output is correct |
8 | Correct | 45 ms | 568 KB | Output is correct |
9 | Correct | 41 ms | 580 KB | Output is correct |
10 | Correct | 27 ms | 460 KB | Output is correct |
11 | Correct | 41 ms | 540 KB | Output is correct |
12 | Correct | 28 ms | 620 KB | Output is correct |
13 | Correct | 24 ms | 632 KB | Output is correct |
14 | Correct | 38 ms | 580 KB | Output is correct |
15 | Correct | 41 ms | 452 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 92 ms | 632 KB | Output is correct |
2 | Correct | 50 ms | 456 KB | Output is correct |
3 | Correct | 51 ms | 596 KB | Output is correct |
4 | Correct | 98 ms | 608 KB | Output is correct |
5 | Correct | 48 ms | 472 KB | Output is correct |
6 | Correct | 69 ms | 608 KB | Output is correct |
7 | Correct | 47 ms | 452 KB | Output is correct |
8 | Correct | 50 ms | 608 KB | Output is correct |
9 | Correct | 72 ms | 640 KB | Output is correct |
10 | Correct | 35 ms | 496 KB | Output is correct |
11 | Correct | 47 ms | 536 KB | Output is correct |
12 | Correct | 36 ms | 664 KB | Output is correct |
13 | Correct | 25 ms | 516 KB | Output is correct |
14 | Correct | 45 ms | 652 KB | Output is correct |
15 | Correct | 34 ms | 452 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 222 ms | 864 KB | Output is correct |
2 | Correct | 155 ms | 628 KB | Output is correct |
3 | Correct | 96 ms | 492 KB | Output is correct |
4 | Correct | 63 ms | 452 KB | Output is correct |
5 | Correct | 59 ms | 556 KB | Output is correct |
6 | Correct | 50 ms | 520 KB | Output is correct |
7 | Correct | 51 ms | 532 KB | Output is correct |
8 | Correct | 52 ms | 608 KB | Output is correct |
9 | Correct | 33 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 580 KB | Output is correct |
2 | Correct | 35 ms | 464 KB | Output is correct |
3 | Correct | 45 ms | 588 KB | Output is correct |
4 | Correct | 83 ms | 724 KB | Output is correct |
5 | Correct | 35 ms | 460 KB | Output is correct |
6 | Correct | 81 ms | 712 KB | Output is correct |
7 | Correct | 41 ms | 472 KB | Output is correct |
8 | Correct | 45 ms | 568 KB | Output is correct |
9 | Correct | 41 ms | 580 KB | Output is correct |
10 | Correct | 27 ms | 460 KB | Output is correct |
11 | Correct | 41 ms | 540 KB | Output is correct |
12 | Correct | 28 ms | 620 KB | Output is correct |
13 | Correct | 24 ms | 632 KB | Output is correct |
14 | Correct | 38 ms | 580 KB | Output is correct |
15 | Correct | 41 ms | 452 KB | Output is correct |
16 | Correct | 92 ms | 632 KB | Output is correct |
17 | Correct | 50 ms | 456 KB | Output is correct |
18 | Correct | 51 ms | 596 KB | Output is correct |
19 | Correct | 98 ms | 608 KB | Output is correct |
20 | Correct | 48 ms | 472 KB | Output is correct |
21 | Correct | 69 ms | 608 KB | Output is correct |
22 | Correct | 47 ms | 452 KB | Output is correct |
23 | Correct | 50 ms | 608 KB | Output is correct |
24 | Correct | 72 ms | 640 KB | Output is correct |
25 | Correct | 35 ms | 496 KB | Output is correct |
26 | Correct | 47 ms | 536 KB | Output is correct |
27 | Correct | 36 ms | 664 KB | Output is correct |
28 | Correct | 25 ms | 516 KB | Output is correct |
29 | Correct | 45 ms | 652 KB | Output is correct |
30 | Correct | 34 ms | 452 KB | Output is correct |
31 | Correct | 222 ms | 864 KB | Output is correct |
32 | Correct | 155 ms | 628 KB | Output is correct |
33 | Correct | 96 ms | 492 KB | Output is correct |
34 | Correct | 63 ms | 452 KB | Output is correct |
35 | Correct | 59 ms | 556 KB | Output is correct |
36 | Correct | 50 ms | 520 KB | Output is correct |
37 | Correct | 51 ms | 532 KB | Output is correct |
38 | Correct | 52 ms | 608 KB | Output is correct |
39 | Correct | 33 ms | 460 KB | Output is correct |
40 | Correct | 0 ms | 204 KB | Output is correct |
41 | Correct | 0 ms | 204 KB | Output is correct |
42 | Correct | 2 ms | 204 KB | Output is correct |
43 | Correct | 9 ms | 332 KB | Output is correct |
44 | Correct | 6 ms | 332 KB | Output is correct |
45 | Correct | 5 ms | 332 KB | Output is correct |
46 | Correct | 31 ms | 452 KB | Output is correct |
47 | Correct | 168 ms | 872 KB | Output is correct |
48 | Correct | 190 ms | 924 KB | Output is correct |
49 | Correct | 233 ms | 736 KB | Output is correct |