| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1310902 | theiulius | Data Transfer (IOI19_transfer) | C++20 | 6 ms | 1720 KiB |
#include "transfer.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
std::vector<int> get_attachment(std::vector<int> a) {
vector<int> v;
int n = a.size();
for (int k = 5; k >= 0; k--){
int i = 0;
int ans = 0;
while (i < n){
for (int j = i; j < i + (1 << k); j++){
// cout << k << " " << j << endl;
ans ^= a[j];
}
i += 2 * (1 << k);
}
v.pb(ans);
}
int ans = 0;
for (int i = 0; i < n; i++){
ans ^= a[i];
}
v.pb(ans);
// for (auto h : v){
// cout << h;
// }
// cout << endl;
return v;
}
std::vector<int> retrieve(std::vector<int> a) {
int n = a.size() - 7;
int K = 7;
int ans0 = 0;
for (int i = 0; i < n; i++){
// cout << a[i];
ans0 ^= a[i];
}
// cout << endl;
int l = 0, r = 62;
for (int k = 5; k >= 0; k--){
int i = 0;
int ans = 0;
while (i < n){
for (int j = i; j < i + (1 << k); j++){
// cout << k << " " << j << endl;
ans ^= a[j];
}
i += 2 * (1 << k);
}
// cout << l << " " << r << endl;
if (a[n + (5 - k)] != ans){ // pirvel naxevarshia
if (ans0 != a[n + K - 1]){ // n-shia corrupted
r = (l + r) / 2;
}else{
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
return a;
}
}else{ // meore naxevarshia
if (ans0 != a[n + K - 1]){ // n-shia corrupted
l = (l + r + 1) / 2;
}
}
}
// cout << l << " " << r << endl;
a[r] ^= 1;
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
a.pop_back();
return a;
// 011001010110110110100111110011010111111111111000101011100101001
// 011001010110110110100111110011010111111111111000101011100101001
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
