Submission #1224437

#TimeUsernameProblemLanguageResultExecution timeMemory
1224437sokratisiInside information (BOI21_servers)C++20
0 / 100
9 ms328 KiB
#include <bits/stdc++.h> using namespace std; int n, q, a, b; int toleft[125000], toright[125000]; char c; int main() { scanf("%d%d", &n, &q); for (int i = 0; i < n + q - 1; i++) { scanf("%d", &c); scanf("%d", &c); if (c == 'S') { scanf("%d%d", &a, &b); if (a > b) swap(a, b); // so a < b toright[a] = toright[b] + 1; toleft[b] = toleft[a] + 1; } if (c == 'Q') { scanf("%d%d", &a, &b); // does a store b if (a < b) { if (toright[a] >= b - a) { printf("yes\n"); } else { printf("no\n"); } } else { if (toleft[a] >= a - b) { printf("yes\n"); } else { printf("no\n"); } } } } return 0; }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:12:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'char*' [-Wformat=]
   12 |         scanf("%d", &c); scanf("%d", &c);
      |                ~^   ~~
      |                 |   |
      |                 |   char*
      |                 int*
      |                %hhd
servers.cpp:12:34: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'char*' [-Wformat=]
   12 |         scanf("%d", &c); scanf("%d", &c);
      |                                 ~^   ~~
      |                                  |   |
      |                                  |   char*
      |                                  int*
      |                                 %hhd
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:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d", &c); scanf("%d", &c);
      |         ~~~~~^~~~~~~~~~
servers.cpp:12:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d", &c); scanf("%d", &c);
      |                          ~~~~~^~~~~~~~~~
servers.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:20:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |             scanf("%d%d", &a, &b); // does a store b
      |             ~~~~~^~~~~~~~~~~~~~~~
#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...