Submission #829649

#TimeUsernameProblemLanguageResultExecution timeMemory
829649RifalData Transfer (IOI19_transfer)C++14
0 / 100
6 ms2492 KiB
#include <bits/stdc++.h> #include "transfer.h" using namespace std; std::vector<int> get_attachment(std::vector<int> source) { vector<int> v; int cnt = 0; for(int i = 0; i < source.size(); i++) { /// v.push_back(source[i]); if(source[i] == 1) cnt ^= i; } int cnt2 = 0; for(int i = 0; i < 8; i++) { if((cnt&(1<<i)) > 0) { v.push_back(1); cnt2++; } else { v.push_back(0); } } if(cnt2%2 == 0) v.push_back(0); else v.push_back(1); return v; } std::vector<int> retrieve(std::vector<int> data) { vector<int> v; int siz = data.size(); int a = 0, b = 0, cnt = 0; for(int i = 0; i < siz-9; i++) { v.push_back(data[i]); if(data[i] == 1) a ^= i; } for(int i = siz-9; i < siz-2; i++) { if(data[i] == 1) { b += (1<<(i-(siz-9))); cnt++;} } if(b == a) return v; if(cnt%2 != data[siz-1]) return v; int x = (a^b); v[x] ^= 1; return v; }

Compilation message (stderr)

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:7:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i = 0; i < source.size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...