제출 #838674

#제출 시각아이디문제언어결과실행 시간메모리
838674oscar1f동굴 (IOI13_cave)C++17
0 / 100
3 ms828 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; const int MAX_VAL=5000+5; int nbVal,ans,nbFait,deb,fin,mid; vector<int> quest; vector<int> repPos,rep; int numPorte[MAX_VAL],repEtat[MAX_VAL]; void modif() { for (int i=0;i<nbFait;i++) { quest[numPorte[i]]=repEtat[i]; } } int askQuest(vector<int> v) { int arr[nbVal]; copy(v.begin(),v.end(),arr); return tryCombination(arr); } void exploreCave(int N) { nbVal=N; for (int i=0;i<nbVal;i++) { quest.clear(); for (int j=0;j<nbVal;j++) { quest.push_back(0); } modif(); ans=askQuest(quest); if (ans>=i) { repEtat[i]=0; } else { repEtat[i]=1; } deb=0; fin=nbVal-1; while (deb!=fin) { mid=(deb+fin)/2; for (int j=0;j<nbVal;j++) { if (j>=deb and j<=mid) { quest.push_back(repEtat[i]); } else { quest.push_back(1-repEtat[i]); } } modif(); ans=askQuest(quest); if (ans>=i) { fin=mid; } else { deb=mid+1; } } repEtat[i]=deb; nbFait++; } for (int i=0;i<nbVal;i++) { rep.push_back(repEtat[i]); for (int j=0;j<nbVal;j++) { if (repEtat[j]==i) { rep.push_back(j); } } } int arrPos[nbVal],arrRep[nbVal]; copy(repPos.begin(),repPos.end(),arrPos); copy(rep.begin(),rep.end(),arrRep); answer(arrPos,arrRep); }
#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...