Submission #235335

#TimeUsernameProblemLanguageResultExecution timeMemory
235335crossing0verCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; int n,type[5005],P[5000],oc[5000],C[5000]; int ask(int S[]) { int x = tryCombination(S); if (x == -1) x = n; return x; } void get_type (int pos,int *A[]) { int l = 0, r = n - 1; int x = ask(A); if (pos <= x) type[pos] = 0,A[pos] = 0; else type[pos] = 1, A[pos] = 1; while (l != r) { int m = (l + r)/2; for (int i = l; i <= m; i++) if (!oc[i]) A[i]^=1; int x = ask(A); if (pos <= x) { l = m + 1; } else r = m; for (int i = l; i <= m; i++) if (!oc[i]) A[i]^=1; } /* if (l == r - 1) { if (oc[l]) x = r; else if (oc[r]) x = l; else { A[l]^=1; int t = ask(A); if (pos <= t) x = r; else x = l; A[l]^=1; } } */ x = l; oc[x] = 1; C[x] = type[pos]; P[x] = pos; } void exploreCave(int N) { n = N; int A[n]; memset(A,0,sizeof A); for (int i = 0;i < n; i++) { get_type(i,A); } int S[N],D[N]; for (int i = 0; i < n; i++) S[i] = C[i], D[i] = P[i]; answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'void get_type(int, int**)':
cave.cpp:14:15: error: cannot convert 'int**' to 'int*' for argument '1' to 'int ask(int*)'
  int x = ask(A);
               ^
cave.cpp:16:33: error: invalid conversion from 'int' to 'int*' [-fpermissive]
    else type[pos] = 1, A[pos] = 1;
                                 ^
cave.cpp:20:48: error: invalid operands of types 'int*' and 'int' to binary 'operator^'
   for (int i = l; i <= m; i++) if (!oc[i]) A[i]^=1;
                                            ~~~~^~~
cave.cpp:20:50: error:   in evaluation of 'operator^=(int*, int)'
   for (int i = l; i <= m; i++) if (!oc[i]) A[i]^=1;
                                                  ^
cave.cpp:21:16: error: cannot convert 'int**' to 'int*' for argument '1' to 'int ask(int*)'
   int x = ask(A);
                ^
cave.cpp:26:48: error: invalid operands of types 'int*' and 'int' to binary 'operator^'
   for (int i = l; i <= m; i++) if (!oc[i]) A[i]^=1;
                                            ~~~~^~~
cave.cpp:26:50: error:   in evaluation of 'operator^=(int*, int)'
   for (int i = l; i <= m; i++) if (!oc[i]) A[i]^=1;
                                                  ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:51:15: error: cannot convert 'int*' to 'int**' for argument '2' to 'void get_type(int, int**)'
   get_type(i,A);
               ^