Submission #863653

#TimeUsernameProblemLanguageResultExecution timeMemory
863653Ahmed_SolymanInside information (BOI21_servers)C++14
5 / 100
3564 ms378684 KiB
/* In the name of Allah made by: Ahmed_Solyman */ #include <bits/stdc++.h> #include <ext/rope> using namespace std; using namespace __gnu_cxx; #pragma GCC optimize("-Ofast") #pragma GCC optimize("-O1") //-------------------------------------------------------------// typedef long long ll; typedef unsigned long long ull; #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define PI acos(-1) #define lb lower_bound #define ub upper_bound #define endl '\n' #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend() #define sum_to(n) (n*(n+1))/2 #define pb push_back #define pf push_front #define fil(arr,x) memset(arr,x,sizeof(arr)) const ll mod=1e9+7; int dx[8]={0,1,0,-1,1,1,-1,-1}; int dy[8]={1,0,-1,0,1,-1,-1,1}; //-------------------------------------------------------------// ll lcm(ll a,ll b) { return (max(a,b)/__gcd(a,b))*min(a,b); } void person_bool(bool x) { cout<<(x?"yes":"no")<<endl; } int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); #ifndef ONLINE_JUDGE //freopen("input.in", "r", stdin); //freopen("output.out", "w", stdout); #endif fast int n,q;cin>>n>>q; q+=n; q--; set<int>adj[n+5]; for(int i=1;i<=n;i++)adj[i].insert(i); vector<int>cnt(n+5,1); while(q--){ char c;cin>>c; if(c=='S'){ int a,b;cin>>a>>b; for(int i=1;i<=n;i++){ if(adj[b].find(i)!=adj[b].end()){ int u=adj[a].size(); adj[a].insert(i); if(adj[a].size()==u+1)cnt[i]++; } if(adj[a].find(i)!=adj[a].end()){ int u=adj[b].size(); adj[b].insert(i); if(adj[b].size()==u+1)cnt[i]++; } } } else if(c=='Q'){ int a,b;cin>>a>>b; bool ok=adj[a].find(b)!=adj[a].end(); person_bool(ok); } else{ int d;cin>>d; cout<<cnt[d]<<endl; } } return 0; }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:61:37: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   61 |                     if(adj[a].size()==u+1)cnt[i]++;
      |                        ~~~~~~~~~~~~~^~~~~
servers.cpp:66:37: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   66 |                     if(adj[b].size()==u+1)cnt[i]++;
      |                        ~~~~~~~~~~~~~^~~~~
#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...