Submission #1224383

#TimeUsernameProblemLanguageResultExecution timeMemory
1224383JerInside information (BOI21_servers)C++20
0 / 100
37 ms1096 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, -1, 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); if (min(a, b) == 1) printf("%s\n", (p[max(a, b)] != -1) ? "yes" : "no"); else printf("%s\n", (p[a] != -1 and p[b] != -1 and p[a] > p[b]) ? "yes" : "no"); } if (t == 'C') { scanf("%d", &c); if (p[c] == -1) printf("1\n"); else printf("%d\n", passed - p[c] + 1); } } return 0; }

Compilation message (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:39:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |             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...