제출 #551505

#제출 시각아이디문제언어결과실행 시간메모리
551505beedle동굴 (IOI13_cave)C++17
0 / 100
510 ms476 KiB
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <set> #include <iterator> #include <stack> #include <map> #include <math.h> #include <bitset> #include <deque> #include <string> #include <tuple> #include <queue> #include <numeric> #include <unordered_set> #include <unordered_map> #define pi 3.141592653589793238 #define ll long long #define ld long double #define rep(i, a, b) for (long long i = a; i <= b; i++) #define mod 998244353ll #define INF 1000000000000000000 #define pb push_back #define ff first #define ss second #define endl '\n' #define all(x) (x).begin (), (x).end () #define sz(x) (ll) (x).size () #define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin()) #define rank rnk #define log lg #define fast \ ios_base::sync_with_stdio (false); \ cin.tie (NULL); \ cout.tie (NULL) #include "cave.h" using namespace std; // int tryCombination(int s[]) // { // int n=4; // rep(i,0,n-1) // cout<<s[i]<<" "; // cout<<endl; // fflush(stdout); // int x; // cin>>x; // return x; // } // void answer(int s[], int d[]) // { // int n=4; // rep(i,0,n-1) // cout<<s[i]<<" "; // cout<<endl; // rep(i,0,n-1) // cout<<d[i]<<" "; // cout<<endl; // fflush(stdout); // } void exploreCave(int n) { bool known[n]; rep(i,0,n-1) known[i]=false; int actual[n]; int binding[n]; vector <int> idx; rep(i,0,n-1) idx.pb(i); rep(door,0,n-1) { int q[n]; for(auto x:idx) q[x]=0; rep(i,0,n-1) if(known[i]) q[i]=actual[i]; int ans=tryCombination(q); int expected; if(ans==-1 || ans>door) expected=0; else expected=1; int lo=0; int hi=sz(idx)-1; while(hi-lo!=0) { int mid=(lo+hi)/2; rep(i,0,n-1) if(known[i]) q[i]=actual[i]; rep(i,lo,mid) q[idx[i]]=expected; rep(i,mid+1,hi) q[idx[i]]=1^expected; ans=tryCombination(q); if(ans==-1 || ans>door) { hi=mid; } else { lo=mid+1; } } known[hi]=true; binding[hi]=door; actual[hi]=expected; vector <int> nidx; for(auto x:idx) if(x!=hi) nidx.pb(x); idx=nidx; } answer(actual,binding); } // signed main() // { // // fast; // // freopen("milkorder.in","r",stdin); // // freopen("milkorder.out","w",stdout); // exploreCave(4); // return 0; // }
#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...