Submission #952372

#TimeUsernameProblemLanguageResultExecution timeMemory
952372SmuggingSpunData Transfer (IOI19_transfer)C++14
0 / 100
6 ms4624 KiB
#include "transfer.h" #include<bits/stdc++.h> using namespace std; vector<int>get_attachment(vector<int>source){ int BIT = (source.size() == 63 ? 6 : 8), x = 0, cnt_1 = 0; for(int i = 0; i < source.size(); i++){ if(source[i] == 1){ x ^= i + 1; cnt_1++; } } vector<int>data = source; for(int i = 0; i < BIT; i++){ if(1 << i & x){ data.emplace_back(1); } else{ data.emplace_back(0); } } data.emplace_back(cnt_1 & 1); return data; } vector<int>retrieve(vector<int>data){ int BIT = (data.size() == 70 ? 6 : 8), n = (BIT == 6 ? 63 : 255), sum_xor = 0, data_xor = 0, cnt_1 = 0; vector<int>ans(n); for(int i = 0; i < n; i++){ if(data[i] == 1){ sum_xor ^= i + 1; cnt_1++; } ans[i] = data[i]; } for(int i = 0; i < BIT; i++){ if(data[n + i]){ data_xor |= 1 << i; } } if(data_xor != sum_xor){ if((cnt_1 & 1) != data.back()){ ans[data_xor ^ sum_xor] ^= 1; } } return ans; }

Compilation message (stderr)

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:6:19: 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++){
      |                 ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...