답안 #1006274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1006274 2024-06-23T16:00:30 Z Almonther Data Transfer (IOI19_transfer) C++17
40 / 100
56 ms 2764 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 n=source.size();
    ll num=0;
    ll pa=0;
    for(int i=0;i<n;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()<((n==255)?8:6)) 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 n=arr.size();
    ll pa,pa1,num;
    pa=0,pa1=0,num=0;
    ll test=arr[n-1];
    ll n1=((n>255)?255:63);
    vector<int>ans;
    for(int i=n1;i<n1+((n>255)?8:6);i++){
        num=num*2+arr[i];
    }
    for(int i=0;i<n1;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<n1;i++){
                ans.push_back(arr[i]);
            }
            ans[num-1]^=1;
            return ans;
        }
        else{
            for(int i=0;i<n1;i++){
                ans.push_back(arr[i]);
            }
            return ans;
        }
    }
    else{
        for(int i=0;i<255;i++){
            ans.push_back(arr[i]);
        }
        return ans;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 780 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 2508 KB Output is correct
2 Correct 50 ms 2500 KB Output is correct
3 Correct 48 ms 2512 KB Output is correct
4 Correct 52 ms 2504 KB Output is correct
5 Correct 46 ms 2504 KB Output is correct
6 Correct 53 ms 2500 KB Output is correct
7 Correct 49 ms 2756 KB Output is correct
8 Correct 53 ms 2516 KB Output is correct
9 Correct 53 ms 2504 KB Output is correct
10 Correct 48 ms 2512 KB Output is correct
11 Correct 49 ms 2516 KB Output is correct
12 Correct 47 ms 2508 KB Output is correct
13 Correct 49 ms 2764 KB Output is correct
14 Correct 53 ms 2504 KB Output is correct
15 Correct 56 ms 2504 KB Output is correct
16 Correct 52 ms 2516 KB Output is correct
17 Correct 52 ms 2512 KB Output is correct
18 Correct 49 ms 2512 KB Output is correct
19 Correct 52 ms 2508 KB Output is correct