# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71785 | 2018-08-25T15:49:07 Z | tamtam | Cave (IOI13_cave) | C++14 | 1042 ms | 640 KB |
#include "cave.h" #include<bits/stdc++.h> #define F first #define S second typedef long long ll; using namespace std; int n; bool done[5010]; int correctpos[5010]; int whichdoor[5010]; int ask[5010]; vector<int> cur; pair<int,int> Solve(int door){ cur.clear(); int correct; for (int i=0;i<n;i++){ if (!done[i]){cur.push_back(i);ask[i]=0;} else ask[i]=correctpos[i]; } int x=tryCombination(ask); if (x==-1||x>door){ correct=0; }else { correct=1; } int st=0,en=cur.size()-1; int mid; int ans=cur.size()-1; while (st<=en){ mid=(st+en)/2; for (int i=0;i<cur.size();i++){ if (i<=mid){ ask[cur[i]]=correct; }else { ask[cur[i]]=1-correct; } } x=tryCombination(ask); if (x==-1||x>door){ ans=mid; en=mid-1; }else { st=mid+1; } } return {cur[ans],correct}; } void exploreCave(int N) { n=N; for (int i=0;i<n;i++){ pair<int,int> x=Solve(i); whichdoor[x.F]=i; correctpos[x.F]=x.S; } answer(correctpos,whichdoor); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 589 ms | 640 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1034 ms | 544 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Incorrect | 1042 ms | 512 KB | Answer is wrong |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 512 KB | Output is correct |
2 | Correct | 5 ms | 512 KB | Output is correct |
3 | Incorrect | 6 ms | 384 KB | Answer is wrong |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 512 KB | Output is correct |
2 | Correct | 5 ms | 512 KB | Output is correct |
3 | Incorrect | 6 ms | 384 KB | Answer is wrong |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 589 ms | 640 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |