Submission #711216

# Submission time Handle Problem Language Result Execution time Memory
711216 2023-03-16T10:19:14 Z Darren0724 Data Transfer (IOI19_transfer) C++17
60 / 100
7 ms 2488 KB
#include "transfer.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> get_attachment(std::vector<int> source) {
	int n=source.size();
    vector<int> a(7),b(7);
    for(int j=0;j<6;j++){
        for(int i=0;i<n;i++){
            if(i&(1<<j)){
                b[j]^=source[i];
            }
            else{
                a[j]^=source[i];
            }
        }
    }
    for(int i=0;i<n;i++){
        a[6]^=source[i];
    }
    return a;

}

std::vector<int> retrieve(std::vector<int> data) {
    vector<int> v=data;
    int n=v.size();
    vector<int> a(6),b(6);
    for(int i=63;i<69;i++){
        a[i-63]=v[i];
        b[i-63]=v[69]^a[i-63];
    }
    vector<int> a1(6),b1(6);
    for(int j=0;j<6;j++){
        for(int i=0;i<63;i++){
            if(i&(1<<j)){
                b1[j]^=v[i];
            }
            else{
                a1[j]^=v[i];
            }
        }
    }
    int ans=0;
    int cnt=0;
    for(int j=0;j<6;j++){
        if(a[j]!=a1[j]){
            cnt++;
        }
        if(b[j]!=b1[j]){
            cnt++;
            ans^=(1<<j);
        }
    }
    vector<int> ans1(63);
    //cout<<cnt<<' '<<ans<<endl;
    for(int i=0;i<63;i++){
        ans1[i]=v[i];
    }

    if(cnt==6&&ans!=63){
        ans1[ans]^=1;
    }

    return ans1;

}

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:27:9: warning: unused variable 'n' [-Wunused-variable]
   27 |     int n=v.size();
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 640 KB Output is correct
2 Correct 5 ms 644 KB Output is correct
3 Correct 5 ms 652 KB Output is correct
4 Correct 5 ms 644 KB Output is correct
5 Correct 5 ms 656 KB Output is correct
6 Correct 5 ms 740 KB Output is correct
7 Correct 5 ms 644 KB Output is correct
8 Correct 5 ms 648 KB Output is correct
9 Correct 5 ms 664 KB Output is correct
10 Correct 5 ms 652 KB Output is correct
11 Correct 5 ms 644 KB Output is correct
12 Correct 5 ms 652 KB Output is correct
13 Correct 5 ms 740 KB Output is correct
14 Correct 5 ms 652 KB Output is correct
15 Correct 5 ms 652 KB Output is correct
16 Correct 5 ms 732 KB Output is correct
17 Correct 5 ms 652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2488 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -