Submission #838675

#TimeUsernameProblemLanguageResultExecution timeMemory
838675oscar1fCave (IOI13_cave)C++17
Compilation error
0 ms0 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(v); } 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(repPos,rep); }

Compilation message (stderr)

cave.cpp: In function 'int askQuest(std::vector<int>)':
cave.cpp:22:27: error: cannot convert 'std::vector<int>' to 'int*'
   22 |     return tryCombination(v);
      |                           ^
      |                           |
      |                           std::vector<int>
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:75:12: error: cannot convert 'std::vector<int>' to 'int*'
   75 |     answer(repPos,rep);
      |            ^~~~~~
      |            |
      |            std::vector<int>
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~