Submission #771994

#TimeUsernameProblemLanguageResultExecution timeMemory
771994Valters07Minerals (JOI19_minerals)C++14
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> #include "minerals.h" #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt") #define fio ios_base::sync_with_stdio(0);cin.tie(0); #define ll long long #define en cin.close();return 0; #define pb push_back #define fi first//printf("%lli\n",cur); #define se second//scanf("%lli",&n); using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n1, cur; int q(int x) { return cur=Query(x); } void go(vector<int> &a, vector<int> &b, bool isa, bool isb) { for(auto x:a)cout << x << " ";cout << endl; for(auto x:b)cout << x << " ";cout << endl; cout << endl; assert(a.size()==b.size()); int n = a.size(), mid = 0.37*n; if(n==1) Answer(a[0],b[0]); else if(isb) { vector<int> la, ra, lb, rb; for(int i = 0;i<n;i++) { if(i<mid) { if(!isa) q(a[i]); la.pb(a[i]); } else { if(isa) q(a[i]); ra.pb(a[i]); } } for(int i = 0, lst=cur;i<n;i++) { int t = q(b[i]); if(t==lst) lb.pb(b[i]); else rb.pb(b[i]); lst=t; } go(la,lb,1,0); go(ra,rb,0,0); } else { vector<int> la, ra, lb, rb; for(int i = 0;i<n;i++) { if(i<mid) { if(!isa) q(a[i]); la.pb(a[i]); } else { if(isa) q(a[i]); ra.pb(a[i]); } } for(int i = 0, lst=cur;i<n;i++) { int t = q(b[i]); if(t==lst) lb.pb(b[i]); else rb.pb(b[i]); lst=t; } go(la,lb,1,1); go(ra,rb,0,1); } } void Solve(int n) { n1=cur=n; vector<int> a, b; for(int i = 1, lst = 0;i<=2*n;i++) { int t = q(i); if(t==lst) b.pb(i); else a.pb(i); lst=t; } go(a,b,1,1); }

Compilation message (stderr)

minerals.cpp: In function 'void go(std::vector<int>&, std::vector<int>&, bool, bool)':
minerals.cpp:20:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |     for(auto x:a)cout << x << " ";cout << endl;
      |     ^~~
minerals.cpp:20:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   20 |     for(auto x:a)cout << x << " ";cout << endl;
      |                                   ^~~~
minerals.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |     for(auto x:b)cout << x << " ";cout << endl;
      |     ^~~
minerals.cpp:21:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   21 |     for(auto x:b)cout << x << " ";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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...