Submission #1224487

#TimeUsernameProblemLanguageResultExecution timeMemory
1224487sokratisiInside information (BOI21_servers)C++20
2 / 100
44 ms1096 KiB
#include <bits/stdc++.h> using namespace std; int n, q, a, b; char c; int table[125000]; // what time did thing connecting 1 and b come int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; i++) table[i] = INT_MAX; table[1] = -1; int cnt = 0; for (int i = 0; i < n + q - 1; i++) { scanf("%c", &c); scanf("%c", &c); if (c == 'S') { scanf("%d%d", &a, &b); table[max(a, b)] = cnt++; } if (c == 'Q') { scanf("%d%d", &a, &b); // does a have b // iff d came before a if (b == 1) { if (table[a] != INT_MAX) printf("yes\n"); else printf("no\n"); continue; } if (a == 1) { if (table[b] != INT_MAX) printf("yes\n"); else printf("no\n"); continue; } if (table[b] <= table[a] && table[a] != INT_MAX) printf("yes\n"); else printf("no\n"); } if (c == 'C') { scanf("%d", &a); if (a == 1) { printf("%d\n", cnt+1); } else if (table[a] == INT_MAX) { printf("1\n"); } else { printf("%d\n", table[a]+2); } } } 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, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%c", &c); scanf("%c", &c);
      |         ~~~~~^~~~~~~~~~
servers.cpp:15:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%c", &c); scanf("%c", &c);
      |                          ~~~~~^~~~~~~~~~
servers.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
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); // does a have b
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:37:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             scanf("%d", &a);
      |             ~~~~~^~~~~~~~~~
#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...