Submission #1224438

#TimeUsernameProblemLanguageResultExecution timeMemory
1224438sokratisiInside information (BOI21_servers)C++20
5 / 100
46 ms1608 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("%c", &c); scanf("%c", &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: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("%c", &c); scanf("%c", &c);
      |         ~~~~~^~~~~~~~~~
servers.cpp:12:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%c", &c); scanf("%c", &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...