Submission #144714

#TimeUsernameProblemLanguageResultExecution timeMemory
144714sochoData Transfer (IOI19_transfer)C++14
0 / 100
13 ms2480 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> source) { int BLE; int n = source.size(); if (n == 63) BLE = 6; else BLE = 8; int att[BLE]; memset(att, 0, sizeof att); for (int i=0; i<BLE; i++) { for (int j=0; j<n; j++) { if (source[j] == 1) { if ((1 << i) & j) { att[i]++; } } } att[i] = att[i] % 2; } vector<int> fn; int sm = 0; for (int i=0; i<BLE; i++) { fn.push_back(att[i]); sm += att[i]; } sm = sm % 2; fn.push_back(sm); return fn; } vector<int> retrieve(vector<int> data) { int n; int BLE; if (data.size() == 70) { n = 63; BLE = 6; } else { n = 255; BLE = 8; } vector<int> rec; for (int i=n; i<data.size(); i++) { rec.push_back(data[i]); } int sm = 0; for (int i=0; i<BLE; i++) { sm += rec[i]; } sm = sm % 2; if (sm != data[data.size()-1]) { vector<int> act; for (int i=0; i<n; i++) { act.push_back(data[i]); } return act; } int att[BLE]; memset(att, 0, sizeof att); for (int i=0; i<BLE; i++) { for (int j=0; j<n; j++) { if (data[j] == 1) { if ((1 << i) & j) { att[i]++; } } } att[i] = att[i] % 2; } vector<int> act; for (int i=0; i<n; i++) { act.push_back(data[i]); } bool flag = false; for (int i=0; i<BLE; i++) { if (rec[i] != att[i]) { flag = true; } } if (!flag) return act; int con = 0; for (int i=0; i<BLE; i++) { if (rec[i] != att[i]) { con += (1 << i); } } act[con] = 1 - act[con]; return act; }

Compilation message (stderr)

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:51:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=n; i<data.size(); i++) {
                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...