Submission #1006267

# Submission time Handle Problem Language Result Execution time Memory
1006267 2024-06-23T15:54:55 Z Almonther Data Transfer (IOI19_transfer) C++17
40 / 100
85 ms 2516 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;
    ll num=0;
    ll pa=0;
    for(int i=0;i<255;i++){
        if(source[i]) num^=i+1;
        pa^=source[i];
    }
    string s="";
    while(num){
        s+='0'+(num%2);
        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[263];
    vector<int>ans;
    for(int i=255;i<263;i++){
        num=num*2+arr[i];
    }
    for(int i=0;i<255;i++){
        pa^=arr[i];
        if(arr[i]) num^=i+1;
    }
    pa1=pa;
    if(num){
        if(arr[num-1]) pa1=((pa1-1)%2+2)%2;
        else pa1=(pa1+1)%2;
        if(pa1==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 1 ms 780 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 2504 KB Output is correct
2 Correct 54 ms 2500 KB Output is correct
3 Correct 56 ms 2504 KB Output is correct
4 Correct 53 ms 2508 KB Output is correct
5 Correct 49 ms 2504 KB Output is correct
6 Correct 52 ms 2504 KB Output is correct
7 Correct 59 ms 2512 KB Output is correct
8 Correct 64 ms 2516 KB Output is correct
9 Correct 59 ms 2500 KB Output is correct
10 Correct 55 ms 2512 KB Output is correct
11 Correct 54 ms 2512 KB Output is correct
12 Correct 54 ms 2504 KB Output is correct
13 Correct 54 ms 2512 KB Output is correct
14 Correct 80 ms 2504 KB Output is correct
15 Correct 85 ms 2504 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 61 ms 2508 KB Output is correct
18 Correct 78 ms 2500 KB Output is correct
19 Correct 54 ms 2504 KB Output is correct