Submission #1096325

#TimeUsernameProblemLanguageResultExecution timeMemory
1096325vjudge1Inside information (BOI21_servers)C++14
5 / 100
642 ms524288 KiB
#include<iostream> #include<cstdio> #include<cstring> #include<vector> #define reg register using namespace std; const int N=300000; int n,m,s,l,k,cnt[N]; vector<int>num[N]; vector<int>a; int main() { scanf("%d%d",&n,&k); k+=n-1; for(reg int i=1;i<=n;i++) { num[i].push_back(i); cnt[i]=1; } for(;k;k--) { char op=getchar(); while(op!='S'&&op!='Q'&&op!='C') op=getchar(); if(op=='S') { int x,y; scanf("%d%d",&x,&y); a=num[y]; for(auto z:num[x]) { num[y].push_back(z); ++cnt[z]; } for(auto z:a) { num[x].push_back(z); ++cnt[z]; } } if(op=='Q') { int x,y; scanf("%d%d",&x,&y); bool flag=0; for(auto z:num[x]) if(z==y) { flag=1; break; } if(flag) puts("yes"); else puts("no"); } if(op=='C') { int x; scanf("%d",&x); printf("%d\n",cnt[x]); } } }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d%d",&n,&k);
      |  ~~~~~^~~~~~~~~~~~~~
servers.cpp:28:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |    scanf("%d%d",&x,&y);
      |    ~~~~~^~~~~~~~~~~~~~
servers.cpp:44:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |    scanf("%d%d",&x,&y);
      |    ~~~~~^~~~~~~~~~~~~~
servers.cpp:60:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |    scanf("%d",&x);
      |    ~~~~~^~~~~~~~~
#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...