제출 #711010

#제출 시각아이디문제언어결과실행 시간메모리
711010becaidoData Transfer (IOI19_transfer)C++17
60 / 100
3062 ms2444 KiB
#include <bits/stdc++.h> #include "transfer.h" using namespace std; vector<int> get_attachment(vector<int> source) { int n = source.size(); vector<int> val(__lg(n + 1) + 1); for (int i = 1, cnt = 0; cnt < n; i++) if (__builtin_popcount(i) > 1) { if (source[cnt]) { for (int j = 0; j <= __lg(n + 1); j++) { val[j] ^= i >> j & 1; } } cnt++; } return val; } vector<int> retrieve(vector<int> data) { int n = data.size(); n = (n == 70 ? 63 : 255); vector<int> val; while (data.size() > n) { val.emplace_back(data.back()); data.pop_back(); } reverse(val.begin(), val.end()); if (get_attachment(data) == val) return data; for (int &x : data) { x ^= 1; if (get_attachment(data) == val) return data; x ^= 1; } return data; }

컴파일 시 표준 에러 (stderr) 메시지

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:23:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     while (data.size() > n) {
      |            ~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...