Submission #213381

# Submission time Handle Problem Language Result Execution time Memory
213381 2020-03-25T16:37:35 Z _Ice_Tea_ Data Transfer (IOI19_transfer) C++14
15 / 100
318 ms 3560 KB
#include<bits/stdc++.h>
#include "transfer.h"

using namespace std;

std::vector<int> get_attachment(std::vector<int> source) {

	int i,j;

	int N = source.size();
	vector<int> attach;
	int key = 0;
	for( i=0; i < N; i++)
	{
		attach.push_back( source[i] );
		key ^= source[i];
	}
	attach.push_back(key);
	return attach;
}

std::vector<int> retrieve(std::vector<int> data) {

	int i,j;
	int N = data.size() / 2;

	vector<int> ans;
	bool flag = 0;
	for( i=0; i<N; i++)
	{
		if( data[i] != data[N+i] )
			flag = 1;
	}

	if( flag )
	{
		int key = 0;
		for( i=0; i<N; i++)
			key ^= data[i];

		if( key == data.back())
		{
			for( i=0; i<N; i++)
				ans.push_back(data[i]);
		}
		else
		{
			for( i=0; i<N; i++)
				ans.push_back(data[N+i]);
		}
	}
	else
	{
		for( i=0; i<N; i++)
			ans.push_back(data[i]);
	}
	return ans;
}

Compilation message

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:8:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j;
        ^
transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:24:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j;
        ^
# Verdict Execution time Memory Grader output
1 Partially correct 18 ms 1136 KB Partially correct
2 Partially correct 18 ms 1124 KB Partially correct
3 Partially correct 17 ms 1124 KB Partially correct
4 Partially correct 18 ms 1132 KB Partially correct
5 Partially correct 18 ms 1124 KB Partially correct
6 Partially correct 17 ms 976 KB Partially correct
7 Partially correct 17 ms 1128 KB Partially correct
8 Partially correct 18 ms 1132 KB Partially correct
9 Partially correct 17 ms 1100 KB Partially correct
10 Partially correct 17 ms 1132 KB Partially correct
11 Partially correct 24 ms 1044 KB Partially correct
12 Partially correct 17 ms 1140 KB Partially correct
13 Partially correct 18 ms 1144 KB Partially correct
14 Partially correct 17 ms 1132 KB Partially correct
15 Partially correct 17 ms 1400 KB Partially correct
16 Partially correct 17 ms 1384 KB Partially correct
17 Partially correct 17 ms 916 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 315 ms 3444 KB Partially correct
2 Partially correct 312 ms 3556 KB Partially correct
3 Partially correct 311 ms 3448 KB Partially correct
4 Partially correct 315 ms 3560 KB Partially correct
5 Partially correct 310 ms 3444 KB Partially correct
6 Partially correct 315 ms 3468 KB Partially correct
7 Partially correct 318 ms 3424 KB Partially correct
8 Partially correct 313 ms 3556 KB Partially correct
9 Partially correct 318 ms 3280 KB Partially correct
10 Partially correct 312 ms 3552 KB Partially correct
11 Partially correct 304 ms 3296 KB Partially correct
12 Partially correct 310 ms 3556 KB Partially correct
13 Partially correct 311 ms 3440 KB Partially correct
14 Partially correct 314 ms 3448 KB Partially correct
15 Partially correct 315 ms 3284 KB Partially correct
16 Partially correct 307 ms 3452 KB Partially correct
17 Partially correct 306 ms 3284 KB Partially correct
18 Partially correct 310 ms 3476 KB Partially correct
19 Partially correct 309 ms 3560 KB Partially correct