Submission #829852

#TimeUsernameProblemLanguageResultExecution timeMemory
829852vqpahmadData Transfer (IOI19_transfer)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define F first #define S second #define endl '\n' #define pb push_back #define sz(a) (int)a.size() #define all(a) a.begin(),a.end() const int mod = 1e9 + 7; const int N = 1e6 + 15; const ll inf = 1e18; #include "transfer.h" vector<int> get_attachment(vector<int> source) { int n = sz(source); int B; if (n<=63){ B = 7; } else B = 9; vector<int> a(B); for (int i=1;i<=n;i++){ for (int b=0;b<B-1;b++){ if ((i>>b)&1) a[b] ^= source[i-1]; } } for (int i=0;i<B-1;i++){ a[B-1] ^= a[i]; } return a; } vector<int> retrieve(vector<int> data) { int n = sz(data)-9; if (n<=63+7){ B = 7; } else B = 9; int ans = 0; bool ok = 1; int cur = 0; for (int i=n;i<n+B-1;i++){ cur ^= data[i]; } ok &= data.back()==cur; vector<int> c(B-1); for (int i=1;i<=n;i++){ for (int b=0;b<B-1;b++){ if ((i>>b)&1) c[b] ^= data[i-1]; } } for (int i=n;i<n+B-1;i++){ if (data[i] != c[i-n]) ans |= (1<<(i-n)); } vector<int> fin_ans(n); if (ans==0 or !ok){ for (int i=0;i<n;i++){ fin_ans[i] = data[i]; } } else { for (int i=0;i<n;i++){ if (ans==i+1) fin_ans[i] = 1^data[i]; else fin_ans[i] = data[i]; } } return fin_ans; }

Compilation message (stderr)

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:39:3: error: 'B' was not declared in this scope
   39 |   B = 7;
      |   ^
transfer.cpp:41:7: error: 'B' was not declared in this scope
   41 |  else B = 9;
      |       ^
transfer.cpp:46:19: error: 'B' was not declared in this scope
   46 |  for (int i=n;i<n+B-1;i++){
      |                   ^
transfer.cpp:50:16: error: 'B' was not declared in this scope
   50 |  vector<int> c(B-1);
      |                ^