제출 #1224368

#제출 시각아이디문제언어결과실행 시간메모리
1224368JerInside information (BOI21_servers)C++20
0 / 100
17 ms1348 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 120005;
int n, k;
int p[MAXN];

int main(){
    scanf("%d%d", &n, &k);
    memset(p, INT_MAX, sizeof p);

    char t;
    int a, b, c;
    int passed = 0;
    for (int z = 0; z < n + k - 1; z++)
    {
        scanf(" %c", &t);

        if (t == 'S')
        {
            scanf("%d%d", &a, &b);
            p[max(a, b)] = passed;
            passed++;
        }

        if (t == 'Q')
        {
            scanf("%d%d", &a, &b);
            printf("%s\n", (p[a] > p[b]) ? "yes" : "no");
        }

        if (t == 'C')
        {
            scanf("%d", &c);
            if (p[c] == INT_MAX)
                printf("1\n");
            else
                printf("%d\n", passed - p[c] + 1);
        }
    }

    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:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf(" %c", &t);
      |         ~~~~~^~~~~~~~~~~
servers.cpp:22:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:29:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:35:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |             scanf("%d", &c);
      |             ~~~~~^~~~~~~~~~
#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...