Submission #1048310

#TimeUsernameProblemLanguageResultExecution timeMemory
1048310TahirAliyevData Transfer (IOI19_transfer)C++17
0 / 100
3 ms2512 KiB
#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 (stderr)

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++){
      |                 ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...