제출 #370673

#제출 시각아이디문제언어결과실행 시간메모리
370673fhvirusXoractive (IZhO19_xoractive)C++17
컴파일 에러
0 ms0 KiB
// Knapsack DP is harder than FFT. #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ff first #define ss second #define pb emplace_back #define FOR(i,n) for(int i = 0; i < (n); ++i) #define FOR(i,a,b) for(int i = (a); i <= (b); ++i) #define AI(x) (x).begin(),(x).end() template<typename I> bool chmax(I &a, I b){ return a < b ? (a = b, true) : false;} template<typename I> bool chmin(I &a, I b){ return a > b ? (a = b, true) : false;} #ifdef OWO #define debug(args...) LKJ("[ " + string(#args) + " ]", args) void LKJ(){ cerr << endl;} template<typename I, typename...T> void LKJ(I&&x, T&&...t){ cerr<<x<<", ", LKJ(t...);} template<typename I> void DE(I a, I b){ while(a < b) cerr<<*a<<" \n"[next(a)==b], ++a;} #else #define debug(...) 0 #define DE(...) 0 #endif #include "interactive.h" using namespace std; vector<int> guess(int n) { int k = __lg(n) + 1; vector<int> ans; vector<vector<int>> ss(k, vector<int>()); ans.pb(ask(1)); FOR(j,k){ vector<int> q; FOR(i,n) if(i>>j&1) q.pb(i+1); vector<int> r = get_pairwise_xor(q); q.pb(1); ss[j] = get_pairwise_xor(q); ss[j].erase(ss[j].begin()); // a[0] ^ a[0] for(int x: r) ss[j].erase(AI(ss[j]), x); for(int &i: ss[j]) i ^= ans[0]; } FOO(i,1,n-1){ vector<int> v; FOR(j,k){ if((i>>j&1)^1) continue; if(v.empty()) v = ss[j]; else{ vector<int> w; for(int x: ss[j]) if(v.find(AI(v), x) != v.end()) w.pb(x); v.swap(w); } } FOR(j,k){ if(i>>j&1) continue; for(int x: ss[j]){ auto it = v.find(AI(v), x); if(it != v.end()) v.erase(it); } } ans.pb(v[0]); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

Xoractive.cpp:10: warning: "FOR" redefined
   10 | #define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
      | 
Xoractive.cpp:9: note: this is the location of the previous definition
    9 | #define FOR(i,n) for(int i = 0; i < (n); ++i)
      | 
Xoractive.cpp:30:9: error: macro "FOR" requires 3 arguments, but only 2 given
   30 |  FOR(j,k){
      |         ^
Xoractive.cpp:10: note: macro "FOR" defined here
   10 | #define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
      | 
Xoractive.cpp:32:10: error: macro "FOR" requires 3 arguments, but only 2 given
   32 |   FOR(i,n) if(i>>j&1) q.pb(i+1);
      |          ^
Xoractive.cpp:10: note: macro "FOR" defined here
   10 | #define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
      | 
Xoractive.cpp:43:10: error: macro "FOR" requires 3 arguments, but only 2 given
   43 |   FOR(j,k){
      |          ^
Xoractive.cpp:10: note: macro "FOR" defined here
   10 | #define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
      | 
Xoractive.cpp:54:10: error: macro "FOR" requires 3 arguments, but only 2 given
   54 |   FOR(j,k){
      |          ^
Xoractive.cpp:10: note: macro "FOR" defined here
   10 | #define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
      | 
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:30:2: error: 'FOR' was not declared in this scope
   30 |  FOR(j,k){
      |  ^~~
Xoractive.cpp:41:6: error: 'i' was not declared in this scope
   41 |  FOO(i,1,n-1){
      |      ^
Xoractive.cpp:41:2: error: 'FOO' was not declared in this scope; did you mean 'FOR'?
   41 |  FOO(i,1,n-1){
      |  ^~~
      |  FOR