Submission #985306

#TimeUsernameProblemLanguageResultExecution timeMemory
985306SzymonKrzywdaCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include"cave.h" #include <bits/stdc++.h> using namespace std; int tryCombination(int S[]); void answer(int S[],int D[]); void exploreCave(int N){ int S[N]; //int S_2[N]; // 0 0 0 0 0 // 1 1 1 1 1 // 1 1 1 1 0 //1110 //3102 vector<int> D_1(N); vector<int> D_2(N,1); bool good[N]; int D[N]; int w = 0,akt=0,w_2=0; while (w != -1){ if (akt == 0){ w = tryCombination(D_1); if (w == -1) D=D_1; for (int i=0; i<N; i++){ if (!good[i]){ D_1[i] = 1; w_2 = tryCombination(D_1); if (w_2 < w){ D_2[i] = 0; D_1[i] = 0; good[i] = true; } else if(w_2 > w){ good[i] = true; } else D_1[i] = 0; } } } else{ w = tryCombination(D_2); if (w == -1) D=D_2; for (int i=0; i<N; i++){ if (!good[i]){ D_2[i] = 0; w_2 = tryCombination(D_2); if (w_2 < w){ D_2[i] = 1; D_1[i] = 1; good[i] = true; } else if(w_2 > w){ good[i] = true; } else D_1[i] = 1; } } } akt = (akt+1)%2; } for (int i=0; i<N; i++){ S[i] = (S[i]+1)%2; D[i] = tryCombination(S); S[i] = (S[i]+1)%2; } answer(S,D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:26:32: error: cannot convert 'std::vector<int>' to 'int*'
   26 |             w = tryCombination(D_1);
      |                                ^~~
      |                                |
      |                                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:27:27: error: incompatible types in assignment of 'std::vector<int>' to 'int [N]'
   27 |             if (w == -1) D=D_1;
      |                          ~^~~~
cave.cpp:31:42: error: cannot convert 'std::vector<int>' to 'int*'
   31 |                     w_2 = tryCombination(D_1);
      |                                          ^~~
      |                                          |
      |                                          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:45:32: error: cannot convert 'std::vector<int>' to 'int*'
   45 |             w = tryCombination(D_2);
      |                                ^~~
      |                                |
      |                                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:46:27: error: incompatible types in assignment of 'std::vector<int>' to 'int [N]'
   46 |             if (w == -1) D=D_2;
      |                          ~^~~~
cave.cpp:50:42: error: cannot convert 'std::vector<int>' to 'int*'
   50 |                     w_2 = tryCombination(D_2);
      |                                          ^~~
      |                                          |
      |                                          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[]);
      |                    ~~~~^~~