제출 #885835

#제출 시각아이디문제언어결과실행 시간메모리
885835BBart888동굴 (IOI13_cave)C++14
51 / 100
930 ms852 KiB
#include <cstdio> #include <iostream> #include <vector> #include <list> #include <string> #include <set> #include <map> #include <algorithm> #include <fstream> #include <cmath> #include <queue> #include <stack> #include <cassert> #include <cstring> #include <climits> #include <functional> #include<cstdlib> //#include "arc.h" #include"cave.h" using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef long long LL; const int MAXN = 5e3 + 11; using ll = long long; typedef vector<int> lnum; const int base = 1e9; const ll mod1 = 1e9 + 7; const ll mod2 = 1000000021; const ll P = 31; /* void setIO(string name = "") { cin.tie(0)->sync_with_stdio(0); // see /general/fast-io if ((name.size())) { freopen((name + ".in").c_str(), "r", stdin); // see /general/input-output freopen((name + ".out").c_str(), "w", stdout); } } */ int N; int arr[MAXN]; bool picked[MAXN]; int chose[MAXN]; int which_door[MAXN]; /* int tryCombination(int S[]) { cout << "Your array sir:\n"; for (int i = 0; i < N; i++) cout << S[i] << " "; cout << "\n"; for (int i = 0; i < N; i++) cout << picked[i] << " "; cout << '\n'; int dec; cin >> dec; return dec; } void answer(int S[], int D[]); */ void ustaw(int l,int r,int mode) { r = min(r, N-1); for (int i = l; i <= r; i++) arr[i] = mode; for (int i = l; i <= r; i++) if (picked[i]) arr[i] = chose[i]; } void exploreCave(int n) { N = n; for (int door = 0; door < n; door++) { ustaw(0, n - 1, 0); //cout << "TERAZ NIE!! BINSERCZ\n"; int now = tryCombination(arr); int what = 0; if (now > door || now == -1) { int opp = 1; for (int j = 13; j >= 0; j--) { ustaw(0, n - 1, opp); ustaw(0, what + (1 << j) - 1, 0); //cout << "TERAZ BINSERCZ\n"; int ch = tryCombination(arr); if (ch <= door && ch != -1) what += (1 << j); ustaw(0, n - 1, 0); } chose[what] = 0; } else { ustaw(0, n - 1, 1); int opp = 0; for (int j = 13; j >= 0; j--) { ustaw(0, n - 1, opp); ustaw(0, what + (1 << j) - 1, 1); //cout << "TERAZ BINSERCZ\n"; int ch = tryCombination(arr); if (ch <= door && ch != -1) what += (1 << j); ustaw(0, n - 1, 1); } chose[what] = 1; } which_door[what] = door; picked[what] = true; } //for (int i = 0; i < n; i++) //cout << which_door[i] << " "; //cout << "\n\n"; ustaw(0, n - 1, 0); //for (int i = 0; i < n; i++) //cout << arr[i] << " "; //cout << "\n\n"; answer(arr, which_door); } /* int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); //setIO("time"); 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...