Submission #339683

# Submission time Handle Problem Language Result Execution time Memory
339683 2020-12-25T23:07:55 Z ogibogi2004 Data Transfer (IOI19_transfer) C++14
0 / 100
7 ms 2604 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
	int xr=0;
	for(int i=0;i<source.size();i++)
	{
		if(source[i]==1)xr^=(i+1);
	}
	vector<int>k;
	for(int i=0;i<9;i++)
	{
		if(xr&(1<<i))k.push_back(1);
		else k.push_back(0);
	}
	return k;
}

vector<int> retrieve(vector<int> data) {
	vector<int>ret;
	int xr1=0,xr2=0;
	for(int i=0;i<data.size()-9;i++)
	{
		ret.push_back(data[i]);
		if(data[i]==1)
		{
			xr1^=(i+1);
		}
	}
	for(int i=data.size()-9;i<data.size();i++)
	{
		if(data[i]==1)
		{
			xr2|=(1<<(i-data.size()+9));
		}
	}
	if((xr1^xr2)==0)return ret;
	ret[(xr1^xr2)-1]^=1;
	return ret;
}

Compilation message

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