답안 #1048310

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1048310 2024-08-08T06:39:03 Z TahirAliyev Data Transfer (IOI19_transfer) C++17
0 / 100
3 ms 2512 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;


vector<int> get_attachment(vector<int> source) {
	int x = 0;
	int n = source.size();
	for(int i = 1; i <= source.size(); i++){
		if(source[i - 1]) x ^= i;
	}
	vector<int> v;
	int l;
	if(n == 63) l = 6;
	else l = 8;
	for(int i = 0; i < l; i++){
		v.push_back(bool(x ^ (1 << i)));
	}
	for(int i = 0; i < l; i++){
		v.push_back(bool(x ^ (1 << i)));
	}
	return v;
}

vector<int> retrieve(vector<int> data) {
	int n, l;
	if(data.size() == 63 + 6) n = 63, l = 6;
	else n = 255, l = 8;
	int x = 0;
	for(int i = 1; i <= n; i++){
		if(data[i - 1]) x ^= i;
	}
	int x1 = 0, x2 = 0;
	for(int i = 0; i < l; i++){
		if(data[n + i]){
			x1 |= (1 << i);
		}
	}
	for(int i = 0; i < l; i++){
		if(data[n + l + i]){
			x2 |= (1 << i);
		}
	}
	if(x1 == x2){
		if(x != x1) data[(x ^ x1) - 1] ^= 1;
	}
	vector<int> v;
	for(int i = 0; i < n; i++) v.push_back(data[i]);
	return v;
}

Compilation message

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:9:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for(int i = 1; i <= source.size(); i++){
      |                 ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1048 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2512 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -