제출 #204734

#제출 시각아이디문제언어결과실행 시간메모리
204734bogdan_ogorodniy동굴 (IOI13_cave)C++14
0 / 100
213 ms512 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const int inf = 1e9 + 7; int N; int _S[5001], _P[5001]; // void answer(int a[], int b[]) { // for (int i = 0; i < N; i++) cout << a[i] << ' '; cout << '\t'; for (int i = 0; i < N; i++) cout << _S[i] << ' '; cout << '\n'; // for (int i = 0; i < N; i++) cout << b[i] << ' '; cout << '\t'; for (int i = 0; i < N; i++) cout << _P[i] << ' '; cout << '\n'; // } // int tryCombination(int a[]) { // int ans = 0; // vector <int> op(N + 1, 0); // for (int i = 0; i < N; i++) { // if (_S[i] == a[i]) op[_P[i]] = true; // } // while (op[ans++]); // return ans - 1; // } int temp[5001]; int s[5001], p[5001]; bool fnd[5001]; void sett(int pos, int f) { for (int i = 0; i < pos; i++) { if (!fnd[i]) { s[i] = f; } else { } } } void exploreCave(int n) { N = n; for (int i = 0; i < n; i++) { // find the switch connected with i-th door // find the switch position 1/0 sett(n, 1); int k = tryCombination(s); // in (fnd) -- already used swithces bool f = 0; if (k >= i || k == -1) { f = true; } else { f = false; } int l = 0, r = n; while (r - l > 0) { int m = (l + r) / 2; sett(m + 1, f); int k = tryCombination(s); if (k >= i) { r = m; } else { l = m + 1; } } p[l] = i; s[l] = f; fnd[l] = true; } answer(s, p); } // signed main() { // N = 4; // _P[0] = 3; _P[1] = 1; _P[2] = 0; _P[3] = 2; // _S[0] = 1; _S[1] = 1; _S[2] = 1; // exploreCave(N); // 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...