Submission #1006198

# Submission time Handle Problem Language Result Execution time Memory
1006198 2024-06-23T14:21:01 Z Almonther Data Transfer (IOI19_transfer) C++17
0 / 100
6 ms 4368 KB
#include <bits/stdc++.h>
#include "transfer.h"
#define ll long long
#define co cout<<
//#pragma GCC optimize("O3,Ofast,unroll-loops")
//#pragma GCC target("avx2,sse3,sse4,avx")
using namespace std;
//stuff

vector<int>get_attachment(vector<int>source){
	vector<int>arr=source;
    ll num=0;
    ll pa=0;
    for(int i=0;i<255;i++){
        pa^=source[i];
        num^=((source[i])?i+1:0);
    }
    string s="";
    while(num){
        s+='0'+(num&1);
        num>>=1;
    }
    reverse(s.begin(),s.end());
    while(s.size()<8) s='0'+s;
    for(auto i:s) arr.push_back(i-'0');
    arr.push_back(pa);
    return arr;
}

vector<int>retrieve(vector<int>data){
    vector<int>arr=data;
    ll pa,pa1,num;
    pa=0,pa1=0,num=0;
    ll test=arr[264];
    vector<int>ans;
    for(int i=255;i<264;i++) num=num*2+arr[i];
    for(int i=0;i<255;i++){
        pa^=arr[i];
        num^=(arr[i]?i+1:0);
    }
    pa1=pa;
    if(num){
        if(arr[num-1]) pa1--;
        else pa1++;
        if((pa1%2+2)%2==test){
            for(int i=0;i<255;i++){
                ans.push_back(arr[i]);
            }
            ans[num-1]^=1;
            return ans;
        }
        else{
            for(int i=0;i<255;i++){
                ans.push_back(arr[i]);
            }
            return ans;
        }
    }
    else{
        for(int i=0;i<255;i++){
            ans.push_back(arr[i]);
        }
        return ans;
    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 780 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 4368 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -