Submission #404957

#TimeUsernameProblemLanguageResultExecution timeMemory
404957VictorChameleon's Love (JOI20_chameleon)C++17
Compilation error
0 ms0 KiB
#include "chameleon.h" #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define per(i, a, b) for (int i = b - 1; i >= (a); --i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) x.size() #define pb push_back #define umap unordered_map #define uset unordered_set typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef long long ll; const int INF = 1'000'000'007; namespace { int variable_example = 1; } // namespace bitset<1001> taken; void bsearch(vi chams, int cham) { if (sz(chams) == 1) { taken[chams[0]-1] = 1; Answer(cham, chams[0]); return; } int si = sz(chams); vi next(si >> 1); rep(i, 0, si >> 1) next[i] = chams[i]; int c1 = Query(next); next.pb(cham); int c2 = Query(next); if (c1 == c2) next.pop_back(); else { next.clear(); rep(i, si >> 1, si)next.pb(chams[i]); } bsearch(next,cham); } void Solve(int n) { rep(i, 0, n*2) { if (taken[i]) continue; taken[i] = 1; vi vec; rep(j, 0, n*2) if (!taken[j]) vec.pb(j + 1); bsearch(vec,i+1); } }#include "chameleon.h" #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define per(i, a, b) for (int i = b - 1; i >= (a); --i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) x.size() #define pb push_back #define umap unordered_map #define uset unordered_set typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef long long ll; const int INF = 1'000'000'007; namespace { int variable_example = 1; } // namespace bitset<1001> taken; void bsearch(vi chams, int cham) { if (sz(chams) == 1) { taken[chams[0]-1] = 1; Answer(cham, chams[0]); return; } int si = sz(chams); vi next(si >> 1); rep(i, 0, si >> 1) next[i] = chams[i]; int c1 = Query(next); next.pb(cham); int c2 = Query(next); if (c1 == c2) next.pop_back(); else { next.clear(); rep(i, si >> 1, si)next.pb(chams[i]); } bsearch(next,cham); } void Solve(int n) { rep(i, 0, n*2) { if (taken[i]) continue; taken[i] = 1; vi vec; rep(j, 0, n*2) if (!taken[j]) vec.pb(j + 1); bsearch(vec,i+1); } }

Compilation message (stderr)

chameleon.cpp:69:2: error: stray '#' in program
   69 | }#include "chameleon.h"
      |  ^
chameleon.cpp:69:3: error: 'include' does not name a type
   69 | }#include "chameleon.h"
      |   ^~~~~~~
chameleon.cpp:93:11: error: redefinition of 'const int INF'
   93 | const int INF = 1'000'000'007;
      |           ^~~
chameleon.cpp:25:11: note: 'const int INF' previously defined here
   25 | const int INF = 1'000'000'007;
      |           ^~~
chameleon.cpp:97:5: error: redefinition of 'int {anonymous}::variable_example'
   97 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
chameleon.cpp:29:5: note: 'int {anonymous}::variable_example' previously defined here
   29 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
chameleon.cpp:101:14: error: redefinition of 'std::bitset<1001> taken'
  101 | bitset<1001> taken;
      |              ^~~~~
chameleon.cpp:33:14: note: 'std::bitset<1001> taken' previously defined here
   33 | bitset<1001> taken;
      |              ^~~~~
chameleon.cpp:103:6: error: redefinition of 'void bsearch(vi, int)'
  103 | void bsearch(vi chams, int cham) {
      |      ^~~~~~~
chameleon.cpp:35:6: note: 'void bsearch(vi, int)' previously defined here
   35 | void bsearch(vi chams, int cham) {
      |      ^~~~~~~
chameleon.cpp:129:6: error: redefinition of 'void Solve(int)'
  129 | void Solve(int n) {
      |      ^~~~~
chameleon.cpp:61:6: note: 'void Solve(int)' previously defined here
   61 | void Solve(int n) {
      |      ^~~~~
chameleon.cpp:29:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   29 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~