Submission #1175740

#TimeUsernameProblemLanguageResultExecution timeMemory
1175740mannshah1211Data Transfer (IOI19_transfer)C++20
Compilation error
0 ms0 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> source) { int xo = 0, cnt = 0; for (int i = 0; i < source.size(); i++) { if (source[i] == 0) { xo ^= i; cnt++; } } vector<int> attachment; for (int i = 5; i >= 0; i--) { if (xo & (1 << i)) { attachment.push_back(1); } else { attachment.push_back(0); } } attachment.push_back(cnt % 2); } vector<int> retrieve(vector<int> data) { int xo = 0, cnt = 0; for (int i = 0; i < data.size() - 7; i++) { if (source[i] == 0) { xo ^= i; cnt++; } } vector<int> ans; for (int i = 0; i < data.size() - 7; i++) { ans.push_back(data[i]); } int reported_parity = data[data.size() - 1], reported_xo = 0; for (int i = data.size() - 7; i < data.size() - 1; i++) { reported_xo = (2 * reported_xo) + data[i]; } if (xo == reported_xo || cnt % 2 == reported_parity) { return ans; } ans[xo ^ reported_xo] = 1 - ans[xo ^ reported_xo]; return ans; }

Compilation message (stderr)

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:28:9: error: 'source' was not declared in this scope
   28 |     if (source[i] == 0) {
      |         ^~~~~~