# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
829691 | 2023-08-18T14:08:42 Z | bane | Data Transfer (IOI19_transfer) | C++17 | 106 ms | 2496 KB |
#include "transfer.h" #include<vector> using namespace std; std::vector<int> get_attachment(std::vector<int> source) { int tot = 0; if (source.size() <= 63)tot = 6; else tot = 8; vector<int>adding(tot + 1, 0); int odd = 0; for (int i = 0; i < source.size(); i++){ odd += source[i]; } adding.back() = odd & 1; int a = 0; for (int i = 0; i < source.size(); i++){ if (source[i]){ a ^= (i + 1); } } for (int j = 0; j < tot; j++){ if (a & (1 << j))adding[j] = 1; } return adding; } std::vector<int> retrieve(std::vector<int> data) { if (data.size() > 100){ int odd = 0; for (int i = 0 ; i < 255; i++){ odd += data[i]; } odd = odd & 1; int xr = 0, xr2 = 0; for (int i = 0; i < 8; i++){ if (data[255 + i])xr2 ^= (1 << i); } for (int i = 0; i < 255; i++){ if (data[i])xr ^= (i + 1); } int ok = (xr == xr2); if (!ok){ if (odd != data.back()){ //first half is fucked for (int i = 0; i < 255; i++){ if ((xr ^ (i + 1)) == xr2){ data[i] ^= 1; //return data; } } }else{ //second half is fucked for (int i = 0; i < 8; i++){ if (((1 << i) ^xr2) == xr){ data[255 + i] ^= 1; //return data; } } } }else{ data.back() ^= 1; } vector<int>ans; for (int i = 0; i < 255; i++)ans.push_back(data[i]); return ans; }else{ int odd = 0; for (int i = 0 ; i < 63; i++){ odd += data[i]; } odd = odd & 1; int xr = 0, xr2 = 0; for (int i = 0; i < 6; i++){ if (data[63 + i])xr2 ^= (1 << i); } for (int i = 0; i < 63; i++){ if (data[i])xr ^= (i + 1); } int ok = (xr == xr2); if (!ok){ if (odd != data.back()){ //first half is fucked for (int i = 0; i < 63; i++){ if ((xr ^ (i + 1)) == xr2){ data[i] ^= 1; //return data; } } }else{ //second half is fucked for (int i = 0; i < 6; i++){ if (((1 << i) ^xr2) == xr){ data[63 + i] ^= 1; //return data; } } } }else{ data.back() ^= 1; //return data; } vector<int>ans; for (int i = 0; i < 63; i++)ans.push_back(data[i]); return ans; } return data; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 640 KB | Output is correct |
2 | Correct | 4 ms | 652 KB | Output is correct |
3 | Correct | 4 ms | 728 KB | Output is correct |
4 | Correct | 4 ms | 732 KB | Output is correct |
5 | Correct | 5 ms | 736 KB | Output is correct |
6 | Correct | 5 ms | 644 KB | Output is correct |
7 | Correct | 4 ms | 716 KB | Output is correct |
8 | Correct | 3 ms | 652 KB | Output is correct |
9 | Correct | 3 ms | 720 KB | Output is correct |
10 | Correct | 3 ms | 724 KB | Output is correct |
11 | Correct | 2 ms | 648 KB | Output is correct |
12 | Correct | 5 ms | 732 KB | Output is correct |
13 | Correct | 4 ms | 644 KB | Output is correct |
14 | Correct | 4 ms | 732 KB | Output is correct |
15 | Correct | 4 ms | 644 KB | Output is correct |
16 | Correct | 4 ms | 644 KB | Output is correct |
17 | Correct | 3 ms | 644 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 2484 KB | Output is correct |
2 | Correct | 87 ms | 2488 KB | Output is correct |
3 | Correct | 94 ms | 2488 KB | Output is correct |
4 | Correct | 85 ms | 2492 KB | Output is correct |
5 | Correct | 86 ms | 2496 KB | Output is correct |
6 | Correct | 93 ms | 2460 KB | Output is correct |
7 | Correct | 86 ms | 2496 KB | Output is correct |
8 | Correct | 87 ms | 2496 KB | Output is correct |
9 | Correct | 77 ms | 2452 KB | Output is correct |
10 | Correct | 77 ms | 2496 KB | Output is correct |
11 | Correct | 80 ms | 2448 KB | Output is correct |
12 | Correct | 106 ms | 2456 KB | Output is correct |
13 | Correct | 92 ms | 2456 KB | Output is correct |
14 | Correct | 85 ms | 2496 KB | Output is correct |
15 | Correct | 82 ms | 2492 KB | Output is correct |
16 | Correct | 98 ms | 2488 KB | Output is correct |
17 | Correct | 91 ms | 2492 KB | Output is correct |
18 | Correct | 91 ms | 2488 KB | Output is correct |
19 | Correct | 81 ms | 2496 KB | Output is correct |