답안 #417647

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417647 2021-06-04T05:36:49 Z 조영욱(#7641) Parking Problem (innopolis2021_final_A) C++17
54 / 100
50 ms 844 KB
#include <bits/stdc++.h>
using namespace std;

int n,m;
char str[100001];
char str2[100001];

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 row=0;
        priority_queue<int> pq;
        for(int i=0;i<n;i++) {
            if (str[i]=='X') {
                if (row!=0) {
                    pq.push(row);
                }
                row=0;
            }
            else {
                row++;
            }
        }
        pq.push(row);
        pq.push(0);
        printf("%c",pq.top()<=1?'N':'Y');
        for(int i=0;i<m;i++) {
            int now=pq.top();
            pq.pop();
            if (str2[i]=='C') {
                now-=3;
            }
            else {
                now-=2;
            }
            pq.push(now);
            printf("%c",pq.top()<=1?'N':'Y');
        }
        printf("\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d",&tc);
      |     ~~~~~^~~~~~~~~~
Main.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%s",str);
      |         ~~~~~^~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%s",str2);
      |         ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 640 KB Output is correct
2 Correct 27 ms 484 KB Output is correct
3 Correct 47 ms 568 KB Output is correct
4 Correct 32 ms 676 KB Output is correct
5 Correct 23 ms 500 KB Output is correct
6 Correct 27 ms 716 KB Output is correct
7 Correct 24 ms 444 KB Output is correct
8 Correct 41 ms 644 KB Output is correct
9 Correct 21 ms 604 KB Output is correct
10 Correct 29 ms 508 KB Output is correct
11 Correct 48 ms 576 KB Output is correct
12 Correct 23 ms 636 KB Output is correct
13 Correct 23 ms 544 KB Output is correct
14 Correct 48 ms 588 KB Output is correct
15 Correct 33 ms 548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 680 KB Output is correct
2 Correct 24 ms 528 KB Output is correct
3 Correct 50 ms 612 KB Output is correct
4 Incorrect 25 ms 652 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 844 KB Output is correct
2 Correct 39 ms 604 KB Output is correct
3 Correct 32 ms 548 KB Output is correct
4 Correct 31 ms 484 KB Output is correct
5 Correct 33 ms 476 KB Output is correct
6 Correct 37 ms 580 KB Output is correct
7 Correct 41 ms 560 KB Output is correct
8 Correct 47 ms 532 KB Output is correct
9 Correct 35 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 640 KB Output is correct
2 Correct 27 ms 484 KB Output is correct
3 Correct 47 ms 568 KB Output is correct
4 Correct 32 ms 676 KB Output is correct
5 Correct 23 ms 500 KB Output is correct
6 Correct 27 ms 716 KB Output is correct
7 Correct 24 ms 444 KB Output is correct
8 Correct 41 ms 644 KB Output is correct
9 Correct 21 ms 604 KB Output is correct
10 Correct 29 ms 508 KB Output is correct
11 Correct 48 ms 576 KB Output is correct
12 Correct 23 ms 636 KB Output is correct
13 Correct 23 ms 544 KB Output is correct
14 Correct 48 ms 588 KB Output is correct
15 Correct 33 ms 548 KB Output is correct
16 Correct 27 ms 680 KB Output is correct
17 Correct 24 ms 528 KB Output is correct
18 Correct 50 ms 612 KB Output is correct
19 Incorrect 25 ms 652 KB Output isn't correct
20 Halted 0 ms 0 KB -