Submission #233811

#TimeUsernameProblemLanguageResultExecution timeMemory
233811dCodingCave (IOI13_cave)C++14
13 / 100
17 ms512 KiB
#include <bits/stdc++.h> #include "cave.h" #define ll long long int #define ld long double #define pb push_back #define mp make_pair #define pii pair<int,int> #define pll pair<ll,ll> #define F first #define S second #define all(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define MS(x,a) memset((x),(a),sizeof(x)) #define F0R(i,n) for(auto (i) = 0; (i) < (n); (i)++) #define FOR(i,a,b) for(auto (i) = (a); (i) <= (b); (i)++) #define ROF(i,a,b) for(auto (i) = (a); (i) >= (b); (i)--) using namespace std; /* int tryCombination(int s[]) { cout << "combo: "; F0R(i,4) cout << s[i] << " "; cout << endl; int x; cin >> x; return x; } void answer(int s[],int d[]) { cout << "s = "; F0R(i,4) cout << s[i] << " "; cout << endl; cout << "d = "; F0R(i,4) cout << d[i] << " "; cout << endl; } */ void exploreCave(int n) { int s[n] = {},d[n] = {}; int sw[n] = {},fixed[n] = {}; deque<int> notdone; F0R(i,n)notdone.pb(i); int cur = tryCombination(s); int hh = 0; while(cur != -1 && !notdone.empty()) { int ele = notdone.front(); notdone.pop_front(); s[ele] ^= 1; int now = tryCombination(s); if(now == -1) { fixed[ele] = true; sw[ele] = s[ele]; d[ele] = cur; cur = -1; break; } else if(now == cur) { notdone.pb(ele); s[ele]^=1; } else { fixed[ele] = true; s[ele] ^= 1; sw[ele] = s[ele]; d[ele] = now; } } F0R(i,n) { if(!fixed[i]) { s[i] ^= 1; int now = tryCombination(s); s[i] ^= 1; sw[i] = s[i]; d[i] = now; fixed[i] = true; } } answer(sw,d); } /* int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); exploreCave(4); } */

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:41:6: warning: unused variable 'hh' [-Wunused-variable]
  int hh = 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...