Submission #339686

# Submission time Handle Problem Language Result Execution time Memory
339686 2020-12-25T23:26:28 Z ogibogi2004 Data Transfer (IOI19_transfer) C++14
88 / 100
125 ms 2612 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
	int xr=0,cnt=0;
	for(int i=0;i<source.size();i++)
	{
		if(source[i]==1)xr^=(i+1),cnt++;
	}
	vector<int>k;
	for(int i=0;i<8;i++)
	{
		if(xr&(1<<i))k.push_back(1);
		else k.push_back(0);
	}
	k.push_back(cnt%2);
	return k;
}

vector<int> retrieve(vector<int> data) {
	vector<int>ret;
	int xr1=0,xr2=0,cnt=0;
	for(int i=0;i<data.size()-9;i++)
	{
		ret.push_back(data[i]);
		if(data[i]==1)
		{
			xr1^=(i+1);cnt++;
		}
	}
	for(int i=data.size()-9;i<data.size()-1;i++)
	{
		if(data[i]==1)
		{
			xr2|=(1<<(i-data.size()+9));
		}
	}
	if(cnt%2==data.back())
	{
		return ret;
	}
	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:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for(int i=0;i<data.size()-9;i++)
      |              ~^~~~~~~~~~~~~~
transfer.cpp:31:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i=data.size()-9;i<data.size()-1;i++)
      |                          ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 1100 KB Partially correct
2 Partially correct 5 ms 1004 KB Partially correct
3 Partially correct 5 ms 876 KB Partially correct
4 Partially correct 5 ms 876 KB Partially correct
5 Partially correct 5 ms 1092 KB Partially correct
6 Partially correct 5 ms 876 KB Partially correct
7 Partially correct 5 ms 1044 KB Partially correct
8 Partially correct 5 ms 1044 KB Partially correct
9 Partially correct 5 ms 1004 KB Partially correct
10 Partially correct 5 ms 1040 KB Partially correct
11 Partially correct 5 ms 876 KB Partially correct
12 Partially correct 5 ms 1004 KB Partially correct
13 Partially correct 5 ms 1140 KB Partially correct
14 Partially correct 5 ms 1004 KB Partially correct
15 Partially correct 5 ms 1100 KB Partially correct
16 Partially correct 5 ms 876 KB Partially correct
17 Partially correct 5 ms 1100 KB Partially correct
# Verdict Execution time Memory Grader output
1 Correct 116 ms 2612 KB Output is correct
2 Correct 120 ms 2604 KB Output is correct
3 Correct 117 ms 2612 KB Output is correct
4 Correct 120 ms 2612 KB Output is correct
5 Correct 125 ms 2592 KB Output is correct
6 Correct 119 ms 2604 KB Output is correct
7 Correct 118 ms 2464 KB Output is correct
8 Correct 121 ms 2604 KB Output is correct
9 Correct 115 ms 2464 KB Output is correct
10 Correct 114 ms 2612 KB Output is correct
11 Correct 116 ms 2592 KB Output is correct
12 Correct 119 ms 2604 KB Output is correct
13 Correct 115 ms 2592 KB Output is correct
14 Correct 115 ms 2592 KB Output is correct
15 Correct 122 ms 2464 KB Output is correct
16 Correct 118 ms 2592 KB Output is correct
17 Correct 122 ms 2592 KB Output is correct
18 Correct 117 ms 2604 KB Output is correct
19 Correct 115 ms 2612 KB Output is correct