Submission #138841

#TimeUsernameProblemLanguageResultExecution timeMemory
138841claudyCave (IOI13_cave)C++14
100 / 100
460 ms644 KiB
# include "cave.h" //# pragma GCC optimize("Ofast,no-stack-protector") //# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") # pragma GCC optimize("Ofast") # pragma GCC optimization ("unroll-loops") # include "bits/stdc++.h" /* # include <ext/pb_ds/tree_policy.hpp> # include <ext/pb_ds/assoc_container.hpp> # include <ext/rope> */ std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}}; # define ll long long # define clock (clock() * 1000.0 / CLOCKS_PER_SEC) # define rc(s) return cout << s,0 # define rcg(s) cout << s;exit(0) # define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); # define db(x) cerr << #x << " = " << x << '\n' # define pb push_back # define mp make_pair # define all(s) s.begin(),s.end() # define sz(x) (int)((x).size()) //# define int ll using namespace std; // 2 : 45 int ask(vector<int>vec) { int s[sz(vec)]; for(int i = 0;i < sz(vec);i++) s[i] = vec[i]; int x = tryCombination(s); if(x == -1) return sz(vec); else return x; } void exploreCave(int n) { vector<int>lst(n,0); int d[n],ans[n]; int used[n];memset(used,0,sizeof(used)); for(int i = 0;i < n;i++) { int op; int init = ask(lst); //db(init); if(init > i) op = 0; else op = 1; vector<int>gg = lst; vector<int>pot; for(int j = 0;j < n;j++) { if(!used[j]) pot.pb(j); } int l = 0; int r = sz(pot) - 1; while(l < r) { int mid = l + r >> 1; for(int j = l;j <= mid;j++) { gg[pot[j]] = 1; } int x = ask(gg); for(int j = l;j <= mid;j++) { gg[pot[j]] = 0; } if(init == i && x > i) r = mid; else if(init > i && x == i) r = mid; else l = mid + 1; } //db(pot[l]); used[pot[l]] = 1; lst[pot[l]] = op; ans[pot[l]] = i; d[pot[l]] = op; } answer(d,ans); }

Compilation message (stderr)

cave.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 # pragma GCC optimization ("unroll-loops")
 
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:61:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    int mid = l + r >> 1;
              ~~^~~
#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...