Submission #727457

#TimeUsernameProblemLanguageResultExecution timeMemory
727457n0sk1llCarnival (CEOI14_carnival)C++17
100 / 100
10 ms336 KiB
#include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0) #define mp make_pair #define xx first #define yy second #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define all(x) x.begin(),x.end() #define ff(i,a,b) for (int i = a; i < b; i++) #define fff(i,a,b) for (int i = a; i <= b; i++) #define bff(i,a,b) for (int i = b-1; i >= a; i--) #define bfff(i,a,b) for (int i = b; i >= a; i--) using namespace std; long double typedef ld; unsigned int typedef ui; long long int typedef li; pair<int,int> typedef pii; pair<li,li> typedef pli; pair<ld,ld> typedef pld; vector<vector<int>> typedef graph; unsigned long long int typedef ull; //const int mod = 998244353; const int mod = 1000000007; //Note to self: Check for overflow int dist[169]; int boja[169]; int ask(vector<int> sta) { cout<<(int)sta.size()<<" "; for (auto it : sta) cout<<it<<" "; cout<<endl; int x; cin>>x; return x; } int main() { FAST; int n; cin>>n; vector<int> tmp; fff(i,1,n) { tmp.pb(i); dist[i]=ask(tmp); } vector<int> crucial; fff(i,1,n) if (dist[i]!=dist[i-1]) crucial.pb(i),boja[i]=(int)crucial.size(); fff(i,1,n) if (!boja[i]) { int l=0,r=(int)crucial.size()-1; while (l!=r) { int mid=(l+r)/2; vector<int> sta; sta.pb(i); fff(j,l,mid) sta.pb(crucial[j]); if (ask(sta)==(int)sta.size()) l=mid+1; else r=mid; } boja[i]=l+1; } cout<<0<<" "; fff(i,1,n) cout<<boja[i]<<" "; cout<<endl; } //Note to self: Check for overflow

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:13:20: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   13 | #define fff(i,a,b) for (int i = a; i <= b; i++)
      |                    ^~~
carnival.cpp:82:5: note: in expansion of macro 'fff'
   82 |     fff(i,1,n) cout<<boja[i]<<" "; cout<<endl;
      |     ^~~
carnival.cpp:82:36: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   82 |     fff(i,1,n) cout<<boja[i]<<" "; cout<<endl;
      |                                    ^~~~
#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...