Submission #995384

# Submission time Handle Problem Language Result Execution time Memory
995384 2024-06-09T02:00:07 Z Bors Data Transfer (IOI19_transfer) C++17
100 / 100
245 ms 3008 KB
#include <bits/stdc++.h>
using namespace std;
#define repf(i,k,n) for(int i=k; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()

typedef vector<int> vi;

vi get_attachment(vi source){
	int n=source.size(),k=(n>200 ? 8:6);

	vi v(k,0);
	rep(i,n){
		rep(j,k) if((i+1)&(1<<j)) v[j]^=source[i];
	}

	int x=0;
	rep(i,n) x^=source[i];
	v.push_back(x);
	return v;
}

vi retrieve(vi data){
	//cerr<<"\n===\n";
	int n=(data.size()>200 ? 255:63),
		k=(n==255?8:6);

	vi v(k,0);
	rep(i,n){
		rep(j,k) if((i+1)&(1<<j)) v[j]^=data[i];
	}
	vi w(k); rep(i,k) w[i]=data[i+n];

	int x=0;
	rep(i,n) x^=data[i];

	//if(x==data.back()) cerr<<"sol1\n";
	if(x==data.back()) return vi(data.begin(),data.begin()+n);

	//if(v==w) cerr<<"sol1\n";
	if(v==w) return vi(data.begin(),data.begin()+n);

	x=0;
	rep(i,k){
		if(v[i]^w[i]) x^=(1<<i); 
	}
	x--;
	//cerr<<"flipped: " << x << '\n';
	data[x]^=1;

	//cerr<<"sol3\n";
	return vi(data.begin(),data.begin()+n);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 780 KB Output is correct
2 Correct 4 ms 796 KB Output is correct
3 Correct 2 ms 796 KB Output is correct
4 Correct 4 ms 788 KB Output is correct
5 Correct 4 ms 796 KB Output is correct
6 Correct 4 ms 796 KB Output is correct
7 Correct 3 ms 1036 KB Output is correct
8 Correct 2 ms 788 KB Output is correct
9 Correct 2 ms 796 KB Output is correct
10 Correct 3 ms 796 KB Output is correct
11 Correct 2 ms 796 KB Output is correct
12 Correct 3 ms 796 KB Output is correct
13 Correct 3 ms 992 KB Output is correct
14 Correct 2 ms 792 KB Output is correct
15 Correct 4 ms 792 KB Output is correct
16 Correct 3 ms 788 KB Output is correct
17 Correct 2 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 218 ms 2512 KB Output is correct
2 Correct 218 ms 2504 KB Output is correct
3 Correct 226 ms 2504 KB Output is correct
4 Correct 218 ms 2756 KB Output is correct
5 Correct 219 ms 2512 KB Output is correct
6 Correct 227 ms 2516 KB Output is correct
7 Correct 219 ms 2500 KB Output is correct
8 Correct 223 ms 2516 KB Output is correct
9 Correct 219 ms 2512 KB Output is correct
10 Correct 225 ms 2508 KB Output is correct
11 Correct 222 ms 2516 KB Output is correct
12 Correct 234 ms 2504 KB Output is correct
13 Correct 220 ms 2504 KB Output is correct
14 Correct 220 ms 2504 KB Output is correct
15 Correct 221 ms 2508 KB Output is correct
16 Correct 227 ms 3008 KB Output is correct
17 Correct 245 ms 2512 KB Output is correct
18 Correct 224 ms 2512 KB Output is correct
19 Correct 226 ms 2508 KB Output is correct