Submission #308242

#TimeUsernameProblemLanguageResultExecution timeMemory
308242cheetoseData Transfer (IOI19_transfer)C++17
0 / 100
8 ms2664 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define X first #define Y second #define y0 y12 #define y1 y22 #define INF 987654321 #define PI 3.141592653589793238462643383279502884 #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c)) #define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c)) #define MEM0(a) memset((a),0,sizeof(a)); #define MEM_1(a) memset((a),-1,sizeof(a)); #define ALL(a) a.begin(),a.end() #define SYNC ios_base::sync_with_stdio(false);cin.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef double db; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int, int> Pi; typedef pair<ll, ll> Pll; typedef pair<ld, ld> Pd; typedef vector<int> Vi; typedef vector<ll> Vll; typedef vector<db> Vd; typedef vector<Pi> VPi; typedef vector<Pll> VPll; typedef vector<Pd> VPd; typedef tuple<int, int, int> iii; typedef tuple<int, int, int, int> iiii; typedef tuple<ll, ll, ll> LLL; typedef vector<iii> Viii; typedef vector<LLL> VLLL; typedef complex<double> base; const int MOD = 1000000007; ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; } int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 }; int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 }; #include "transfer.h" Vi get_attachment(Vi source){ int n=source.size(); Vi res; int t=0; if(n==63){ res.resize(7); fup(i,1,63,1){ if(source[i-1])t^=i; } fup(i,0,5,1){ if(t&(1<<i)){ res[i]=1; res[6]^=1; } } }else{ res.resize(9); if(source[0]==1)res[8]=1; fup(i,1,255,1){ if(source[i-1])t^=i; } fup(i,0,7,1){ if(t&(1<<i)){ res[i]=1; res[8]^=1; } } } return res; } Vi retrieve(Vi data){ int n=data.size(); if(n>200){ Vi v(9); fup(i,255,263,1)v[i-255]=data[i]; data.resize(255); int c=0; fup(i,0,8,1)c^=v[i]; if(c!=0){ return data; }else{ fup(i,0,7,1){ if(v[i])c^=(1<<i); } fup(i,1,255,1)if(data[i-1])c^=i; data[c-1]^=1; return data; } }else{ Vi v(7); fup(i,63,69,1)v[i-63]=data[i]; data.resize(63); int c=0; fup(i,0,6,1)c^=v[i]; if(c!=0){ return data; }else{ fup(i,0,5,1){ if(v[i])c^=(1<<i); } fup(i,1,63,1)if(data[i-1])c^=i; data[c-1]^=1; return data; } } } /* int main() { }*/

Compilation message (stderr)

transfer.cpp: In function 'Vi get_attachment(Vi)':
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:49:3: note: in expansion of macro 'fup'
   49 |   fup(i,1,63,1){
      |   ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:52:3: note: in expansion of macro 'fup'
   52 |   fup(i,0,5,1){
      |   ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:61:3: note: in expansion of macro 'fup'
   61 |   fup(i,1,255,1){
      |   ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:64:3: note: in expansion of macro 'fup'
   64 |   fup(i,0,7,1){
      |   ^~~
transfer.cpp: In function 'Vi retrieve(Vi)':
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:77:3: note: in expansion of macro 'fup'
   77 |   fup(i,255,263,1)v[i-255]=data[i];
      |   ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:80:3: note: in expansion of macro 'fup'
   80 |   fup(i,0,8,1)c^=v[i];
      |   ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:84:4: note: in expansion of macro 'fup'
   84 |    fup(i,0,7,1){
      |    ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:87:4: note: in expansion of macro 'fup'
   87 |    fup(i,1,255,1)if(data[i-1])c^=i;
      |    ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:93:3: note: in expansion of macro 'fup'
   93 |   fup(i,63,69,1)v[i-63]=data[i];
      |   ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:96:3: note: in expansion of macro 'fup'
   96 |   fup(i,0,6,1)c^=v[i];
      |   ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:100:4: note: in expansion of macro 'fup'
  100 |    fup(i,0,5,1){
      |    ^~~
transfer.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
transfer.cpp:103:4: note: in expansion of macro 'fup'
  103 |    fup(i,1,63,1)if(data[i-1])c^=i;
      |    ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...