답안 #339685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
339685 2020-12-25T23:19:08 Z ogibogi2004 Data Transfer (IOI19_transfer) C++14
80 / 100
135 ms 2852 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<9;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()-10;i++)
	{
		ret.push_back(data[i]);
		if(data[i]==1)
		{
			xr1^=(i+1);cnt++;
		}
	}
	for(int i=data.size()-10;i<data.size()-1;i++)
	{
		if(data[i]==1)
		{
			xr2|=(1<<(i-data.size()+10));
		}
	}
	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()-10;i++)
      |              ~^~~~~~~~~~~~~~~
transfer.cpp:31:28: 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()-10;i<data.size()-1;i++)
      |                           ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 5 ms 876 KB Partially correct
2 Partially correct 7 ms 880 KB Partially correct
3 Partially correct 5 ms 1092 KB Partially correct
4 Partially correct 5 ms 880 KB Partially correct
5 Partially correct 5 ms 1100 KB Partially correct
6 Partially correct 5 ms 880 KB Partially correct
7 Partially correct 5 ms 880 KB Partially correct
8 Partially correct 5 ms 880 KB Partially correct
9 Partially correct 5 ms 1140 KB Partially correct
10 Partially correct 5 ms 880 KB Partially correct
11 Partially correct 5 ms 880 KB Partially correct
12 Partially correct 5 ms 1028 KB Partially correct
13 Partially correct 7 ms 1092 KB Partially correct
14 Partially correct 6 ms 1112 KB Partially correct
15 Partially correct 5 ms 920 KB Partially correct
16 Partially correct 5 ms 1048 KB Partially correct
17 Partially correct 5 ms 920 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 117 ms 2624 KB Partially correct
2 Partially correct 121 ms 2608 KB Partially correct
3 Partially correct 119 ms 2512 KB Partially correct
4 Partially correct 126 ms 2604 KB Partially correct
5 Partially correct 124 ms 2468 KB Partially correct
6 Partially correct 117 ms 2648 KB Partially correct
7 Partially correct 119 ms 2852 KB Partially correct
8 Partially correct 119 ms 2640 KB Partially correct
9 Partially correct 117 ms 2612 KB Partially correct
10 Partially correct 115 ms 2640 KB Partially correct
11 Partially correct 116 ms 2596 KB Partially correct
12 Partially correct 120 ms 2468 KB Partially correct
13 Partially correct 119 ms 2604 KB Partially correct
14 Partially correct 118 ms 2604 KB Partially correct
15 Partially correct 116 ms 2604 KB Partially correct
16 Partially correct 118 ms 2596 KB Partially correct
17 Partially correct 119 ms 2656 KB Partially correct
18 Partially correct 135 ms 2604 KB Partially correct
19 Partially correct 117 ms 2640 KB Partially correct