Submission #1224424

#TimeUsernameProblemLanguageResultExecution timeMemory
1224424KALARRYInside information (BOI21_servers)C++20
2 / 100
3596 ms589824 KiB
//chockolateman #include<bits/stdc++.h> using namespace std; int N,K; set<int> contain[120005]; int main() { scanf("%d%d",&N,&K); for(int i = 1 ; i <= N ; i++) contain[i].insert(i); for(int a,b,i = 1 ; i <= N + K - 1 ; i++) { char op; scanf(" %c",&op); scanf("%d",&a); if(op=='C') { int counter = 0; for(int j = 1 ; j <= N ; j++) if(contain[j].count(a)) counter++; printf("%d\n",counter); } else if(op=='Q') { scanf("%d",&b); if(contain[a].count(b)) printf("yes\n"); else printf("no\n"); } else { scanf("%d",&b); for(auto l : contain[a]) contain[b].insert(l); for(auto l : contain[b]) contain[a].insert(l); } } return 0; }

Compilation message (stderr)

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