Submission #408702

#TimeUsernameProblemLanguageResultExecution timeMemory
408702ly20Inside information (BOI21_servers)C++17
5 / 100
2672 ms66544 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 4123; int v[MAXN][MAXN]; int main() { int n, k; scanf("%d %d", &n, &k); k += n - 1; for(int i = 1; i <= n; i++) { v[i][i] = 1; } for(int i = 0; i < k; i++) { char c; scanf(" %c", &c); if(c == 'S') { int a, b; scanf("%d %d", &a, &b); for(int j = 1; j <= n; j++) { if(v[a][j] == 1 || v[b][j] == 1) { v[a][j] = 1; v[b][j] = 1; } } } else if(c == 'Q') { int a, b; scanf("%d %d", &a, &b); if(v[a][b] == 1) printf("yes\n"); else printf("no\n"); } else { int a; scanf("%d", &a); int resp = 0; for(int j = 1; j <= n; j++) resp += v[j][a]; printf("%d\n", resp); } } }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
servers.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         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:26:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |             scanf("%d %d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~~
servers.cpp:32:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |             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...