Submission #918949

#TimeUsernameProblemLanguageResultExecution timeMemory
918949Sputnik123Carnival (CEOI14_carnival)C++14
0 / 100
1 ms344 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <string.h> #include <stdio.h> #include <algorithm> #include <vector> #include <functional> #include <cstdio> #define pb push_back #define in insert #define pll pair<ll,ll> #define vpl vector<pll> #define vll vector <ll> #define vl vector<ll> ///#define mp make_pair #define F first #define S second #define all(v) v.begin(),v.end() #define endl "\n" #define ll int #define ull unsigned long long using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt,fma") const ll sz=150; const ll inf=1e12+7; const ll mod=1e9+7; const ll P=47; const double e=1e-6; ll gcd(ll x,ll y) { return (y ? gcd(y,x%y) : x); } ll lcm(ll x,ll y) { return (x/gcd(x,y))*y; } ll binpow(ll a,ll b) { ll ans=1; a%=mod; while(b) { ans=(b&1 ? (ans*a)%mod : ans); a=(a*a)%mod; b>>=1; } return ans; } ll modm(ll n,ll m,ll md=mod) { if(!m) return 1; ll res=modm(n,m>>1,md); if(m&1) return res*res%md*n%md; return res*res%md; } /**************************/ int col[155],per[155]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; col[1]=1; per[1]=1; int cur=1; for(int i=2;i<=n;i++) { cout<<cur+1<<" "; for(int j=1;j<=cur;j++) cout<<per[j]<<" "; cout<<i<<endl; int res; cin>>res; if(res==cur+1) { col[i]=++cur; per[cur]=i; continue; } ll l=1,r=cur; while(l<r) { int mid=(l+r)>>1; cout<<mid+1<<" "; for(int j=1;j<=mid;j++) cout<<per[j]<<" "; cout<<i<<endl; int res; cin>>res; if(res==mid+1) l=mid+1; else r=mid; } per[l]=i; col[i]=l; } cout<<0<<endl; for(int i=1;i<=n;i++) cout<<col[i]<<" "; cout<<endl; }

Compilation message (stderr)

carnival.cpp:28:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.000000000007e+12' to '2147483647' [-Woverflow]
   28 | const ll inf=1e12+7;
      |              ~~~~^~
#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...