Submission #308239

# Submission time Handle Problem Language Result Execution time Memory
308239 2020-09-30T13:02:22 Z cheetose Data Transfer (IOI19_transfer) C++17
0 / 100
8 ms 2500 KB
#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,62,1){
			if(source[i])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,254,1){
			if(source[i])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){ // 255~262
		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);
			}
			data[c]^=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);
			}
			data[c]^=1;
			return data;
		}
	}
}
/*
int main() {

}*/

Compilation message

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,62,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,254,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:92:3: note: in expansion of macro 'fup'
   92 |   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:95:3: note: in expansion of macro 'fup'
   95 |   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:99:4: note: in expansion of macro 'fup'
   99 |    fup(i,0,5,1){
      |    ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1040 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 2500 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -