답안 #995369

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995369 2024-06-08T23:33:39 Z Bors Data Transfer (IOI19_transfer) C++17
80 / 100
231 ms 2760 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<<j)) v[j]^=source[i];
	}

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

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

	//if(data[n+k]!=data[n+k+1]) cerr<<"sol0\n";
	if(data[n+k]!=data[n+k+1]) return vi(data.begin(),data.end()-k-2);

	int x1=0; rep(i,n) x1^=data[i];
	//if(x1==data.back()) cerr<<"sol1\n";
	if(x1==data.back()) return vi(data.begin(),data.end()-k-2);

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

	//rep(i,k) cerr << w[i] << ' '; cerr<<'\n';
	//rep(i,k) cerr << v[i] << ' '; cerr << '\n';
	

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

	//cerr<<"sol2\n";
	return vi(data.begin(),data.end()-k-2);
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 4 ms 792 KB Partially correct
2 Partially correct 4 ms 800 KB Partially correct
3 Partially correct 4 ms 800 KB Partially correct
4 Partially correct 4 ms 796 KB Partially correct
5 Partially correct 4 ms 800 KB Partially correct
6 Partially correct 3 ms 800 KB Partially correct
7 Partially correct 3 ms 800 KB Partially correct
8 Partially correct 3 ms 792 KB Partially correct
9 Partially correct 3 ms 800 KB Partially correct
10 Partially correct 3 ms 996 KB Partially correct
11 Partially correct 3 ms 792 KB Partially correct
12 Partially correct 3 ms 800 KB Partially correct
13 Partially correct 3 ms 812 KB Partially correct
14 Partially correct 3 ms 800 KB Partially correct
15 Partially correct 4 ms 788 KB Partially correct
16 Partially correct 3 ms 800 KB Partially correct
17 Partially correct 3 ms 784 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 221 ms 2516 KB Partially correct
2 Partially correct 220 ms 2516 KB Partially correct
3 Partially correct 231 ms 2512 KB Partially correct
4 Partially correct 217 ms 2760 KB Partially correct
5 Partially correct 217 ms 2664 KB Partially correct
6 Partially correct 216 ms 2520 KB Partially correct
7 Partially correct 221 ms 2516 KB Partially correct
8 Partially correct 214 ms 2508 KB Partially correct
9 Partially correct 231 ms 2516 KB Partially correct
10 Partially correct 219 ms 2516 KB Partially correct
11 Partially correct 214 ms 2504 KB Partially correct
12 Partially correct 226 ms 2512 KB Partially correct
13 Partially correct 220 ms 2516 KB Partially correct
14 Partially correct 227 ms 2504 KB Partially correct
15 Partially correct 215 ms 2508 KB Partially correct
16 Partially correct 218 ms 2508 KB Partially correct
17 Partially correct 212 ms 2504 KB Partially correct
18 Partially correct 217 ms 2508 KB Partially correct
19 Partially correct 214 ms 2600 KB Partially correct