제출 #1224344

#제출 시각아이디문제언어결과실행 시간메모리
1224344lkaterisInside information (BOI21_servers)C++20
0 / 100
17 ms584 KiB
#include <iostream>

using namespace std;

int lq[120005];

int main() {

    int N,K;
    scanf("%d%d",&N,&K);

    for(int i=1;i<=N;++i) lq[i] = -1;

    int s=0;
    for(int q=1;q<=N+K-1;++q) {
        char t;
        scanf("\n%c",&t);
        if (t == 'S') {
            s++;
            int a,b;
            scanf("%d%d",&a,&b);
            if (a == 1) lq[b] = s;
            else lq[a] = s;
        }
        else if (t == 'Q') {
            int a,d;
            scanf("%d%d",&a,&d);
            if (a == 1 and lq[d] != -1 or a == d) printf("yes\n");
            else if (lq[d] != -1 and lq[a] != -1 and lq[d] < lq[a]) printf("yes\n");
            else printf("no\n");
        }
        else if (t == 'C') {
            int d;
            scanf("%d",&d);
            if (d == 1) printf("%d",s+1);
            else if (lq[d] == -1) printf("1");
            else printf("%d",s-lq[d]+2);
        }

    }


    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

servers.cpp: In function 'int main()':
servers.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d%d",&N,&K);
      |     ~~~~~^~~~~~~~~~~~~~
servers.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("\n%c",&t);
      |         ~~~~~^~~~~~~~~~~
servers.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |             scanf("%d%d",&a,&b);
      |             ~~~~~^~~~~~~~~~~~~~
servers.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |             scanf("%d%d",&a,&d);
      |             ~~~~~^~~~~~~~~~~~~~
servers.cpp:34:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |             scanf("%d",&d);
      |             ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...