답안 #712031

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
712031 2023-03-18T02:01:37 Z chenyan Data Transfer (IOI19_transfer) C++17
0 / 100
7 ms 2484 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> get_attachment(vector<int> a){
	int v=0,i,n=a.size();
	for(i=1;i<=n;i++)if(a[i-1])v^=i;
	vector<int>r;
	for(i=(n<=63?5:7);i>=0;i--) r.pb((v>>i)&1);
	r.pb(v&1);
	return r;
}
vector<int>retrieve(vector<int> a){
	int i,j,n=a.size(),k,v=0,u=0;
	if(n<=70)n-=7,k=7;
	else n=255,k=9;
	for(i=1;i<=n;i++){
		if(a[i-1])v^=i;
	}
	for(i=0;i<k-1;i++){
		u+=(a[i+n]<<(k-2-i));
	}
	if(u==v||(u&1)!=a[n+k-1]){
		a.resize(n);
		return a;
	}
	a[(u^v)-1]^=1;
	a.resize(n);
	return a;
}
/*
int main(){
	int n;
	cin>>n;
	vector<int>v(n);
	for(int i=0;i<n;i++)cin>>v[i];
	vector<int>u=get_attachment(v);
	for(int k:u)cout<<k<<' ';
	cout<<'\n';
	int k;
	cin>>k;
	u[k]^=1;
	for(int u:retrieve(u))
		cout<<u<<' ';
}
*/

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:13:8: warning: unused variable 'j' [-Wunused-variable]
   13 |  int i,j,n=a.size(),k,v=0,u=0;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 648 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2484 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -