Submission #881902

#TimeUsernameProblemLanguageResultExecution timeMemory
8819028pete8Carnival (CEOI14_carnival)C++14
0 / 100
3 ms600 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include <iomanip> #include<numeric> #include<bitset> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define vi vector<int> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-lopps") #define int long long using namespace std; const int mod=1e9+7,mxn=1e3+5,lg=30,inf=1e18,minf=-1e18; int pa[mxn+10]; int find(int u){return pa[u]==u?u:pa[u]=find(pa[u]);} int32_t main(){ int n,m;cin>>n; for(int i=1;i<=n;i++)pa[i]=i; vector<int>v; for(int i=1;i<=n;i++){ cout<<v.size()+1<<" "; cout<<i<<" "; for(auto j:v)cout<<j<<" "; cout<<endl; cin>>m; if(m==v.size()+1)v.pb(i); else{ int l=0,r=v.size()-1,pos=inf; while(l<=r){ int mid=(l+r)/2; cout<<mid+2<<" "; cout<<i<<" "; for(int j=0;j<=mid;j++)cout<<v[j]<<" "; cout<<endl; cin>>m; if(m==mid+1)r=mid-1,pos=min(pos,mid); else l=mid+1; } pa[i]=v[pos]; } } cout<<0<<" "; for(int i=1;i<=n;i++)cout<<find(pa[i])<<" "; cout<<endl; return 0; }

Compilation message (stderr)

carnival.cpp:31:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   31 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
carnival.cpp:36:15: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   36 | int find(int u){return pa[u]==u?u:pa[u]=find(pa[u]);}
      |               ^
carnival.cpp:37:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   37 | int32_t main(){
      |              ^
carnival.cpp: In function 'int32_t main()':
carnival.cpp:47:7: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   if(m==v.size()+1)v.pb(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...