Submission #844780

#TimeUsernameProblemLanguageResultExecution timeMemory
844780midiCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define vc vector typedef vc<ll> vcll; #define pr pair typedef pr<ll, ll> prll; #define f0r(i,a,n) for (i=a; i<n; i++) #define f1r(i,a,n) for (i=a; i<=n; i++) #define r0f(i,n,a) for (i=n; i>a; i--) #define r1f(i,n,a) for (i=n; i>=a; i--) #define pb push_back #define mp make_pair #define INF (LLONG_MAX>>4ll) #define mxN 5010ll ll n; vc<bool> bar(mxN); vcll gar(mxN); // good bar vcll perm(mxN); void exploreCave(int N) { n=N; bar.assign(n, 0); perm.assign(n, -1); gar.assign(n, -1); ll i2; f0r(i2,0,n) { ll i = tryCombination(bar); ll j; ll l=0, r=n-1; // both incl. while (l<r) { ll m; if (l+1==r) m=l; else m = (l+r)/2; ll i3; f1r(i3, l, m) if (gar[i3]!=-1) bar[i3]!=bar[i3]; j = tryCombination(bar); if (j<i) { i=j; r=m; } else if (j==i) { l=m+1; } else { f1r(i3, l, m) if (gar[i3]!=-1) bar[i3]!=bar[i3]; l=m+1; } } gar[l]=bar[l]; perm[l]=i; } // f0r(i,0,n) printf("gar[%lli]: %lli, perm[%lli]: %lli\n", i, gar[i], i, perm[i]); answer(gar, perm); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:39:25: error: cannot convert 'std::vector<bool>' to 'int*'
   39 |   ll i = tryCombination(bar);
      |                         ^~~
      |                         |
      |                         std::vector<bool>
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:49:42: warning: value computed is not used [-Wunused-value]
   49 |    f1r(i3, l, m) if (gar[i3]!=-1) bar[i3]!=bar[i3];
      |                                   ~~~~~~~^~~~~~~~~
cave.cpp:51:23: error: cannot convert 'std::vector<bool>' to 'int*'
   51 |    j = tryCombination(bar);
      |                       ^~~
      |                       |
      |                       std::vector<bool>
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:64:43: warning: value computed is not used [-Wunused-value]
   64 |     f1r(i3, l, m) if (gar[i3]!=-1) bar[i3]!=bar[i3];
      |                                    ~~~~~~~^~~~~~~~~
cave.cpp:75:9: error: cannot convert 'vcll' {aka 'std::vector<long long int>'} to 'int*'
   75 |  answer(gar, perm);
      |         ^~~
      |         |
      |         vcll {aka std::vector<long long 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[]);
      |             ~~~~^~~