Submission #358581

# Submission time Handle Problem Language Result Execution time Memory
358581 2021-01-25T22:32:01 Z Ahmad_Hasan Data Transfer (IOI19_transfer) C++17
60 / 100
7 ms 2468 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;


vector<int> get_attachment(vector<int>src){
    if(src.size()<=3){
        int n=src.size();
        for(int i=0;i<n;i++)src.push_back(src[i]);
        return src;
    }

    int n =src.size();
    vector<int>ret(7);

    int sz=ret.size();
    for(int i=0;i<sz;i++){
        for(int j=0;j<n;j+=2*(1<<i)){
            for(int k=0;k<(1<<i);k++)
                if(j+k<n)
                    ret[i]^=src[j+k];
        }
    }

    return ret;
}

vector<int> retrieve(vector<int>data){
    vector<int>ret;
    if(data.size()<=9){
        int n=data.size();
        for(int i=0;i<n/3;i++){
            ret.push_back(((data[i]+data[n/3+i]+data[2*n/3+i])>=2)?1:0);
        }
    }else{

        /**for(int i=0;i<data.size();i++)cout<<data[i]<<' ';
        cout<<'\n';*/
        int n=data.size()-7;
        int xo=0;
        for(int i=0;i<n;i++) xo^=data[i];
        vector<int>ret;
        if(xo==data[data.size()-1]){
            for(int i=0;i<n;i++){
                ret.push_back(data[i]);
            }
            return  ret;
        }
        int cr=6;
        int l=0;

        while(cr>=0&&l<n){
            int i=cr;
            xo=0;
            for(int j=0;j<n;j+=2*(1<<i)){
                for(int k=0;k<(1<<i);k++)
                    if(j+k<n)
                        xo^=data[j+k];
            }

            if(xo==data[n+cr])
                l+=(1<<cr);
            if(cr==0)data[l]=!data[l];
            ///cout<<l<<' '<<xo<<'\n';

            cr--;
        }
        for(int i=0;i<n;i++){
                ret.push_back(data[i]);
        }
        return  ret;


    }
    return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 880 KB Output is correct
2 Correct 6 ms 1100 KB Output is correct
3 Correct 5 ms 1092 KB Output is correct
4 Correct 6 ms 1092 KB Output is correct
5 Correct 6 ms 1092 KB Output is correct
6 Correct 6 ms 1008 KB Output is correct
7 Correct 6 ms 1100 KB Output is correct
8 Correct 6 ms 1100 KB Output is correct
9 Correct 5 ms 880 KB Output is correct
10 Correct 5 ms 880 KB Output is correct
11 Correct 7 ms 1132 KB Output is correct
12 Correct 6 ms 1092 KB Output is correct
13 Correct 5 ms 880 KB Output is correct
14 Correct 5 ms 880 KB Output is correct
15 Correct 7 ms 1100 KB Output is correct
16 Correct 6 ms 880 KB Output is correct
17 Correct 6 ms 1092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2468 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -