Submission #829689

#TimeUsernameProblemLanguageResultExecution timeMemory
829689haxormanData Transfer (IOI19_transfer)C++14
0 / 100
8 ms2492 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> source) { vector<int> res; for (int j = 0; (1 << j) < source.size(); ++j) { int val = 0; for (int i = 0; i < source.size(); ++i) { if (i & (1 << j)) { val ^= source[i]; } } res.push_back(val); } int end = 0; for (int i = 0; i < source.size(); ++i) { end ^= source[i]; } res.push_back(end); return res; } vector<int> retrieve(vector<int> data) { bool smol = (data.size() == 70); int end = 0; vector<int> source; for (int i = 0; i < data.size() - (smol ? 7 : 9); ++i) { source.push_back(data[i]); end ^= data[i]; } if (end == data.back()) { return source; } vector<int> lst; for (int i = data.size() - (smol ? 7 : 9); i < data.size() - 1; ++i) { lst.push_back(data[i]); } int bad = 0; for (int j = 0; (1 << j) < source.size(); ++j) { int val = 0; for (int i = 0; i < source.size(); ++i) { if (i & (1 << j)) { val ^= source[i]; } } if (val != lst[j]) { bad += (1 << j); } } source[bad] ^= 1; return source; }

Compilation message (stderr)

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:7:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int j = 0; (1 << j) < source.size(); ++j) {
      |                     ~~~~~~~~~^~~~~~~~~~~~~~~
transfer.cpp:9:27: 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 = 0; i < source.size(); ++i) {
      |                         ~~^~~~~~~~~~~~~~~
transfer.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int i = 0; i < source.size(); ++i) {
      |                     ~~^~~~~~~~~~~~~~~
transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for (int i = 0; i < data.size() - (smol ? 7 : 9); ++i) {
      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
transfer.cpp:39:50: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i = data.size() - (smol ? 7 : 9); i < data.size() - 1; ++i) {
      |                                                ~~^~~~~~~~~~~~~~~~~
transfer.cpp:44:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for (int j = 0; (1 << j) < source.size(); ++j) {
      |                     ~~~~~~~~~^~~~~~~~~~~~~~~
transfer.cpp:46:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for (int i = 0; i < source.size(); ++i) {
      |                         ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...