Submission #1099715

#TimeUsernameProblemLanguageResultExecution timeMemory
1099715Ninedesu동굴 (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
    vector<int>test(N),lock(N),pos(N),D(N);
    for(int i=0; i<N; i++){
        lock[i] = -1;
    }
    for(int i=0; i<N; i++){
        int thisans;
        for(int j=0; j<N; j++){
            if(lock[j]!=-1)test[j] = lock[j];
            else test[j] = 0;
        }
        int door = tryCombination(test);
        thisans = (door == i);
        int l=0,r=N-1;
        while(l<r){
            int mid=(l+r)/2;
            for(int j=i; j<=mid; j++){
                if(lock[j]!=-1)test[j] = lock[j];
                else test[j] = 0;
            }
            for(int j=mid+1; j<=r; j++){
                if(lock[j]!=-1)test[j] = lock[j];
                else test[j] = 1;
            }
            door = tryCombination(test);
            if(door > i){
                if(!thisans){
                    r=mid;
                }
                else{
                    l=mid+1;
                }
            }
            else{
                if(!thisans){
                    l=mid+1;
                }
                else{
                    r=mid;
                }
            }
        }
        pos[i]=l;
        lock[l]=thisans;
    }
    for(int i=0; i<N; i++){
        D[pos[i]]=i;
    }
    answer(lock,D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:35: error: cannot convert 'std::vector<int>' to 'int*'
   16 |         int door = tryCombination(test);
      |                                   ^~~~
      |                                   |
      |                                   std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:29:35: error: cannot convert 'std::vector<int>' to 'int*'
   29 |             door = tryCombination(test);
      |                                   ^~~~
      |                                   |
      |                                   std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:53:12: error: cannot convert 'std::vector<int>' to 'int*'
   53 |     answer(lock,D);
      |            ^~~~
      |            |
      |            std::vector<int>
In file included from cave.cpp:1:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~