Submission #367628

# Submission time Handle Problem Language Result Execution time Memory
367628 2021-02-17T19:13:13 Z PurpleCrayon Data Transfer (IOI19_transfer) C++17
80 / 100
215 ms 2756 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define sz(v) int(v.size())

vector<int> get_attachment(vector<int> a) {
    int n = sz(a), B = 31-__builtin_clz(n);

    assert(n&(1<<B)), assert((1<<(B+1))>n);

    vector<int> ans{0};
    for (auto v : a) ans.back() ^= v;
    ans.push_back(ans.back());

    for (int i = 0; i <= B; i++){
        ans.push_back(0);
        for (int j = 0; j < n; j++) if ((j>>i)&1) ans.back() ^= a[j];
    }
    return ans;
}
vector<int> retrieve(vector<int> a) {
    int n=-1;
    if (sz(a) >= 255) n = 255;
    else n = 63;
    int B = 31-__builtin_clz(n);
    assert(n&(1<<B)), assert((1<<(B+1))>n);

    assert(sz(a)==n+1+1+B+1);

    vector<int> ans(a.begin(), a.begin()+n);
    if (a[n] != a[n+1]){
        return ans;
    }
    {
        int c=0;
        for (int i = 0; i < n; i++) c ^= a[i];

        if (c == a[n]) return ans;
    }

    int idx=0;

    for (int i = 0; i <= B; i++){
        int rl=0;
        for (int j = 0; j < n; j++) if ((j>>i)&1) rl ^= a[j];

        if (rl != a[n+2+i]){
            idx ^= 1<<i;
        }
    }
    ans[idx] ^= 1;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 1092 KB Partially correct
2 Partially correct 5 ms 880 KB Partially correct
3 Partially correct 5 ms 880 KB Partially correct
4 Partially correct 5 ms 964 KB Partially correct
5 Partially correct 5 ms 1092 KB Partially correct
6 Partially correct 6 ms 1092 KB Partially correct
7 Partially correct 5 ms 1008 KB Partially correct
8 Partially correct 5 ms 1092 KB Partially correct
9 Partially correct 5 ms 1008 KB Partially correct
10 Partially correct 5 ms 1008 KB Partially correct
11 Partially correct 5 ms 1088 KB Partially correct
12 Partially correct 5 ms 920 KB Partially correct
13 Partially correct 5 ms 1008 KB Partially correct
14 Partially correct 6 ms 1092 KB Partially correct
15 Partially correct 5 ms 880 KB Partially correct
16 Partially correct 5 ms 1080 KB Partially correct
17 Partially correct 5 ms 1228 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 190 ms 2604 KB Partially correct
2 Partially correct 192 ms 2604 KB Partially correct
3 Partially correct 195 ms 2604 KB Partially correct
4 Partially correct 195 ms 2468 KB Partially correct
5 Partially correct 189 ms 2468 KB Partially correct
6 Partially correct 194 ms 2604 KB Partially correct
7 Partially correct 192 ms 2604 KB Partially correct
8 Partially correct 194 ms 2596 KB Partially correct
9 Partially correct 192 ms 2468 KB Partially correct
10 Partially correct 197 ms 2612 KB Partially correct
11 Partially correct 191 ms 2468 KB Partially correct
12 Partially correct 196 ms 2468 KB Partially correct
13 Partially correct 192 ms 2756 KB Partially correct
14 Partially correct 192 ms 2604 KB Partially correct
15 Partially correct 215 ms 2604 KB Partially correct
16 Partially correct 191 ms 2468 KB Partially correct
17 Partially correct 191 ms 2604 KB Partially correct
18 Partially correct 198 ms 2512 KB Partially correct
19 Partially correct 194 ms 2468 KB Partially correct