답안 #711109

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711109 2023-03-16T08:42:21 Z Darren0724 Data Transfer (IOI19_transfer) C++14
0 / 100
5 ms 3004 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();
    if(n==63){
        vector<int> a(7);
        for(int j=0;j<6;j++){
            for(int i=0;i<n;i++){
                if(i&(1<<j)){
                    a[j]^=source[i];
                }
            }
        }
        for(int i=0;i<n;i++){
            a[6]^=source[i];
        }
        /*for(int i:a){
            cout<<i<<' ';
        }
        cout<<endl;*/
        return a;
    }
}

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

        for(int i=0;i<63;i++){
            ans1[i]=v[i];
        }
        //cout<<cnt<<' '<<ans<<endl;
        if(cnt==6){
            ans1[ans]^=1;
        }

        return ans1;
    }
}

Compilation message

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^
transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:28:19: warning: control reaches end of non-void function [-Wreturn-type]
   28 |     vector<int> v=data;
      |                   ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 776 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 3004 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -