| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1310841 | nikoloz-ch | Data Transfer (IOI19_transfer) | C++20 | 50 ms | 1728 KiB |
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> src){
int n = src.size(), kp = (n <= 63 ? 6 : 8);
int p = 0, t = 0;
for(int i = 0; i < n; ++i) if(src[i]) p ^= (i + 1);
vector<int> a;
for(int b = 0; b < kp; ++b){
int bit = (p >> b) & 1;
a.push_back(bit);
t += bit;
}
a.push_back(t % 2);
return a;
}
vector<int> retrieve(vector<int> data){
int n = data.size(), kp = ((n - 7) == 63 ? 6 : 8);
int o = n - (kp + 1), p = 0;
for(int i = 0; i < o; ++i) if(data[i]) p ^= (i + 1);
int k = 0, t = 0;
for(int b = 0; b < kp; ++b){
int idx = o + b;
if(idx < 0 || idx >= n-1) return {};
if(data[idx]){ k |= (1 << b); ++t; }
}
vector<int> ans;
if(data.back() != (t % 2)){
for(int i = 0; i < o; ++i) ans.push_back(data[i]);
return ans;
}
int err = p ^ k;
ans.resize(o);
for(int i = 0; i < o; ++i){
if(err != 0 && i == (err - 1)) ans[i] = data[i] ? 0 : 1;
else ans[i] = data[i];
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
