Submission #241182

#TimeUsernameProblemLanguageResultExecution timeMemory
241182abacabaCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <string> #include <unordered_map> #include <unordered_set> #include <cstring> #include <chrono> #include <vector> #include <map> #include <random> #include <set> #include <algorithm> #include <math.h> #include <cstdio> #include <stdio.h> #include <queue> #include <bitset> #include <cstdlib> #include <deque> #include <cassert> #include <stack> #include "cave.h" using namespace std; #define mp make_pair #define f first #define se second #define pb push_back #define ppb pop_back #define emb emplace_back #define ll long long #define ull unsigned long long #define cntbit(x) __builtin_popcount(x) #define endl '\n' #define uset unordered_set #define umap unordered_map #define pii pair<int, int> #define ld long double #define pll pair<long long, long long> mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline T range(T l, T r) { return uniform_int_distribution<T>(l, r)(rng); } inline void setin(string s) { freopen(s.c_str(), "r", stdin); } inline void setout(string s) { freopen(s.c_str(), "w", stdout); } template <typename T> void Min(T &a, T b) { a = min(a, b); } template <typename T> void Max(T &a, T b) { a = max(a, b); } bool used[MAX_N]; int cur; int correct[MAX_N], door[MAX_N]; int s[MAX_N]; int ask_full(vector <int> now, int n, int c) { for(int i = 0; i < n; ++i) if(used[i]) s[i] = correct[i]; for(int i : now) s[i] = c; return tryCombination(s); } void rec(vector <int> now, int n, int right_c) { if(now.size() == 1) { correct[now[0]] = right_c; door[now[0]] = cur; used[now[0]] = true; } else { vector <int> temp = {}; int mid = now.size() / 2; for(int i = 0; i < now.size(); ++i) { if(i < mid) temp.pb(now[i]); else { used[now[i]] = true; correct[now[i]] = right_c; } } int res = ask_full(temp, n, !right_c); for(int i : now) used[i] = false, correct[i] = -1; if(res == -1 || res > cur) { temp.clear(); for(int i = mid; i < now.size(); ++i) temp.pb(now[i]); } rec(temp, n, right_c); } } void exploreCave(int n) { for(cur = 0; cur < n; ++cur) { vector <int> now = {}; for(int j = 0; j < n; ++j) if(!used[j]) now.pb(j); int x = ask_full(now, n, 1); rec(now, n, x == -1 || x > cur); } answer(correct, door); }

Compilation message (stderr)

cave.cpp:62:11: error: 'MAX_N' was not declared in this scope
 bool used[MAX_N];
           ^~~~~
cave.cpp:64:13: error: 'MAX_N' was not declared in this scope
 int correct[MAX_N], door[MAX_N];
             ^~~~~
cave.cpp:64:26: error: 'MAX_N' was not declared in this scope
 int correct[MAX_N], door[MAX_N];
                          ^~~~~
cave.cpp:65:7: error: 'MAX_N' was not declared in this scope
 int s[MAX_N];
       ^~~~~
cave.cpp: In function 'int ask_full(std::vector<int>, int, int)':
cave.cpp:69:12: error: 'used' was not declared in this scope
         if(used[i])
            ^~~~
cave.cpp:69:12: note: suggested alternative: 'uset'
         if(used[i])
            ^~~~
            uset
cave.cpp:70:13: error: 's' was not declared in this scope
             s[i] = correct[i];
             ^
cave.cpp:70:20: error: 'correct' was not declared in this scope
             s[i] = correct[i];
                    ^~~~~~~
cave.cpp:72:9: error: 's' was not declared in this scope
         s[i] = c;
         ^
cave.cpp:73:27: error: 's' was not declared in this scope
     return tryCombination(s);
                           ^
cave.cpp: In function 'void rec(std::vector<int>, int, int)':
cave.cpp:78:9: error: 'correct' was not declared in this scope
         correct[now[0]] = right_c;
         ^~~~~~~
cave.cpp:79:9: error: 'door' was not declared in this scope
         door[now[0]] = cur;
         ^~~~
cave.cpp:79:9: note: suggested alternative: 'floor'
         door[now[0]] = cur;
         ^~~~
         floor
cave.cpp:80:9: error: 'used' was not declared in this scope
         used[now[0]] = true;
         ^~~~
cave.cpp:80:9: note: suggested alternative: 'uset'
         used[now[0]] = true;
         ^~~~
         uset
cave.cpp:85:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < now.size(); ++i) {
                        ~~^~~~~~~~~~~~
cave.cpp:89:17: error: 'used' was not declared in this scope
                 used[now[i]] = true;
                 ^~~~
cave.cpp:89:17: note: suggested alternative: 'uset'
                 used[now[i]] = true;
                 ^~~~
                 uset
cave.cpp:90:17: error: 'correct' was not declared in this scope
                 correct[now[i]] = right_c;
                 ^~~~~~~
cave.cpp:95:13: error: 'used' was not declared in this scope
             used[i] = false, correct[i] = -1;
             ^~~~
cave.cpp:95:13: note: suggested alternative: 'uset'
             used[i] = false, correct[i] = -1;
             ^~~~
             uset
cave.cpp:95:30: error: 'correct' was not declared in this scope
             used[i] = false, correct[i] = -1;
                              ^~~~~~~
cave.cpp:98:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int i = mid; i < now.size(); ++i)
                              ~~^~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:109:17: error: 'used' was not declared in this scope
             if(!used[j])
                 ^~~~
cave.cpp:109:17: note: suggested alternative: 'uset'
             if(!used[j])
                 ^~~~
                 uset
cave.cpp:114:12: error: 'correct' was not declared in this scope
     answer(correct, door);
            ^~~~~~~
cave.cpp:114:21: error: 'door' was not declared in this scope
     answer(correct, door);
                     ^~~~
cave.cpp:114:21: note: suggested alternative: 'floor'
     answer(correct, door);
                     ^~~~
                     floor