Submission #864568

# Submission time Handle Problem Language Result Execution time Memory
864568 2023-10-23T08:55:43 Z ThylOne Data Transfer (IOI19_transfer) C++14
0 / 100
4 ms 2512 KB
#include "transfer.h"
#include<bits/stdc++.h>

using namespace std;
std::vector<int> get_attachment(std::vector<int> source) {
	int xorIndex=0;
	for(int i=1;i<=source.size();i++){
		if(source[i-1]){
			xorIndex^=i;
		}
	}
	vector<int> bits(7);
	for(int i=0;i<7;i++){
		bits[i]=(xorIndex>>i)&1;
	}
	
	return bits;
}

std::vector<int> retrieve(std::vector<int> data) {
	int len = data.size()-7;
	int xorIndex=0;
	for(int i=1;i<=len;i++){
		//cout<<data[i];
		if(data[i-1]){
			xorIndex^=i;
		}
	}
	//cout<<endl;
	int restitution=0;
	for(int i=0;i<7;i++){
		if(data[i+len]){
			restitution+=(1<<i);
		};
	}
	
	int fake = xorIndex^restitution;
	vector<int> real=data;
	for(int i=0;i<7;i++)real.pop_back();
	if(fake>0)
		real[fake-1] = !real[fake-1];
	
	return real;
}

Compilation message

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:7:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |  for(int i=1;i<=source.size();i++){
      |              ~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 800 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2512 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -