# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
778327 | 2023-07-10T08:35:13 Z | Warinchai | 동굴 (IOI13_cave) | C++14 | 1 ms | 468 KB |
#include<bits/stdc++.h> #include "cave.h" using namespace std; int open[5005]; int cor[5005]; int n; pair<int,int> find(int id){ int ans1,ans2; int ar[n]; for(int i=0;i<n;i++){ if(open[i]!=-1){ ar[i]=open[i]; }else{ ar[i]=0; } } int y=tryCombination(ar); if(y>id||y==-1){ ans1=0; }else{ ans1=1; } vector<int>v; for(int i=0;i<n;i++){ if(open[i]==-1){ v.push_back(i); } } int st=0,en=v.size()-1; while(st<en){ int m=(st+en)/2; for(int j=0;j<=v[m];j++){ if(open[j]!=-1)ar[j]=open[j]; else ar[j]=ans1; } for(int j=v[m]+1;j<n;j++){ if(open[j]!=-1)ar[j]=open[j]; else ar[j]=(ans1^1); } int x=tryCombination(ar); if(x>id||x==-1){ ans1=v[m]; en=m-1; }else{ st=m+1; } } return {ans1,ans2}; } void exploreCave(int sz) { int n=sz; int ANS1[n]; int ANS2[n]; for(int i=0;i<n;i++){ open[i]=-1; cor[i]=-1; } for(int i=0;i<n;i++){ pair<int,int>p=find(i); open[i]=p.first; cor[i]=p.second; } for(int i=0;i<n;i++){ ANS1[i]=open[i]; ANS2[i]=cor[i]; } answer(ANS1,ANS2); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 468 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |