Submission #167299

#TimeUsernameProblemLanguageResultExecution timeMemory
167299theStaticMindTenis (COI19_tenis)C++14
7 / 100
1036 ms9052 KiB
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; vector<vector<int>> data(3,vector<int>(100005)); vector<vector<int>> arr(3); vector<int> P(3,0); int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("q.gir","r",stdin); // freopen("q.cik","w",stdout); int n,q; cin>>n>>q; for(int k=0;k<3;k++) for(int i=0;i<n;i++){ int x; cin>>x; arr[k].pb(x); data[k][x]=i; if(i==0)P[k]=x; } while(q--){ int k; cin>>k; if(k==1){ int x; cin>>x; set<int>cnt; queue<int>Q; cnt.insert(x); Q.push(x); while(!Q.empty()){ int w=Q.front(); Q.pop(); for(k=0;k<3;k++){ for(int j=data[k][w]+1;j<n;j++){ if(cnt.count(arr[k][j]))continue; else{ cnt.insert(arr[k][j]); Q.push(arr[k][j]); } } } } if(cnt.size()==n)cout<<"DA\n"; else cout<<"NE\n"; } else{ int p,x,y; cin>>p>>x>>y;p--; swap(arr[p][data[p][x]],arr[p][data[p][y]]); if(P[p]==x)P[p]=y; else if(P[p]==y)P[p]=x; swap(data[p][x],data[p][y]); } } }

Compilation message (stderr)

tenis.cpp: In function 'int32_t main()':
tenis.cpp:52:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   if(cnt.size()==n)cout<<"DA\n";
                      ~~~~~~~~~~^~~
#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...