Submission #291957

# Submission time Handle Problem Language Result Execution time Memory
291957 2020-09-06T05:31:10 Z Autoratch Data Transfer (IOI19_transfer) C++14
80 / 100
247 ms 2828 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

int ret[10],mxk,n;
vector<int> s;

void send(int l,int r,int k)
{
    if(l==r) return;
    mxk = max(mxk,k);
    int m = (l+r)/2,v = 0;
    for(int i = l;i <= m;i++) v^=s[i];
    ret[k]^=v;
    send(l,m,k+1),send(m+1,r,k+1);
}

vector<int> get_attachment(vector<int> source)
{
    s = source;
    for(int i = 0;i < 10;i++) ret[i] = 0;
    mxk = 0;
    send(0,source.size()-1,0);
    vector<int> tmp;
    for(int i = 0;i <= mxk;i++) tmp.push_back(ret[i]);
    int all = 0;
    for(int x : source) all^=x;
    tmp.push_back(all),tmp.push_back(all);
    return tmp;
}

int solve(int l,int r,int k)
{
    if(l==r) return l;
    int m = (l+r)/2;
    if(ret[k]!=s[n+k]) return solve(l,m,k+1);
    else return solve(m+1,r,k+1);
}

vector<int> retrieve(vector<int> data)
{
    if(data.size()>200) n = 255;
    else n = 63;
    int all = 0;
    for(int i = 0;i < n;i++) all^=data[i];
    if(data[data.size()-1]!=data[data.size()-2] or data.back()==all)
    {
        vector<int> tmp;
        for(int i = 0;i < n;i++) tmp.push_back(data[i]);
        return tmp;
    }
    for(int i = 0;i < 10;i++) ret[i] = 0;
    mxk = 0;
    s = data;
    send(0,n-1,0);
    int idx = solve(0,n-1,0);
    vector<int> tmp;
    for(int i = 0;i < n;i++) tmp.push_back(data[i]);
    tmp[idx]^=1;
    return tmp;
}
# Verdict Execution time Memory Grader output
1 Partially correct 7 ms 1020 KB Partially correct
2 Partially correct 7 ms 1156 KB Partially correct
3 Partially correct 7 ms 1148 KB Partially correct
4 Partially correct 7 ms 1040 KB Partially correct
5 Partially correct 7 ms 1040 KB Partially correct
6 Partially correct 7 ms 1040 KB Partially correct
7 Partially correct 7 ms 1280 KB Partially correct
8 Partially correct 7 ms 1148 KB Partially correct
9 Partially correct 9 ms 1152 KB Partially correct
10 Partially correct 9 ms 1156 KB Partially correct
11 Partially correct 7 ms 1148 KB Partially correct
12 Partially correct 7 ms 1144 KB Partially correct
13 Partially correct 7 ms 1024 KB Partially correct
14 Partially correct 7 ms 1144 KB Partially correct
15 Partially correct 7 ms 1040 KB Partially correct
16 Partially correct 7 ms 1040 KB Partially correct
17 Partially correct 7 ms 912 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 237 ms 2668 KB Partially correct
2 Partially correct 239 ms 2668 KB Partially correct
3 Partially correct 239 ms 2668 KB Partially correct
4 Partially correct 240 ms 2668 KB Partially correct
5 Partially correct 247 ms 2628 KB Partially correct
6 Partially correct 241 ms 2668 KB Partially correct
7 Partially correct 244 ms 2672 KB Partially correct
8 Partially correct 245 ms 2672 KB Partially correct
9 Partially correct 243 ms 2664 KB Partially correct
10 Partially correct 242 ms 2660 KB Partially correct
11 Partially correct 241 ms 2660 KB Partially correct
12 Partially correct 239 ms 2660 KB Partially correct
13 Partially correct 242 ms 2628 KB Partially correct
14 Partially correct 239 ms 2828 KB Partially correct
15 Partially correct 245 ms 2668 KB Partially correct
16 Partially correct 238 ms 2664 KB Partially correct
17 Partially correct 246 ms 2672 KB Partially correct
18 Partially correct 246 ms 2628 KB Partially correct
19 Partially correct 243 ms 2672 KB Partially correct