Submission #554596

# Submission time Handle Problem Language Result Execution time Memory
554596 2022-04-28T21:33:16 Z urosk Data Transfer (IOI19_transfer) C++14
80 / 100
210 ms 2508 KB
#include "transfer.h"
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
using namespace std;

vector<int> get_attachment(vector<int> a) {
    int n = sz(a);
    int x = 0;
    vector<int> ans;
    for(int i = 0;i<n;i++){
        if(a[i]==0) x^=1;
    }
    ans.pb(x);
    ans.pb(x);
    x = 0;
    ll nn = n+1;
    ll d =0;
    while(nn>0){
        nn/=2;
        d++;
    }
    for(ll i = 0;i<n;i++){
        if(a[i]==0) x^=i;
    }
    while(x>0){
        d--;
        ans.pb(x&1);
        x/=2;
    }
    while(d--) ans.pb(0);
    return ans;
}
//n 4 n/2
vector<int> retrieve(vector<int> a) {
    int m = sz(a);
    int n = 1;
    while(1){
        ll g = 0;
        ll f = n;
        while(f>0){
            f/=2;
            g++;
        }
        if(n+g+2<m){
            n++;
            continue;
        }
        break;
    }
    n--;
    //cerr<<n<<" "<<m<<endl;
    vector<int> ans;
    ll x = 0;
    for(ll i = n+2;i<sz(a);i++){
        x+=a[i]*(1<<(i-n-2));
    }
    ll y = 0;
    ll z = 0;
    for(ll i = 0;i<n;i++){
        ans.pb(a[i]);
        if(a[i]==0){
            y^=i;
            z^=1;
        }
    }
    if(a[n]!=a[n+1])return ans;
    if(z==a[n]) return ans;
    x^=y;
    ans[x]^=1;
    return ans;
}
/*
1
4 010101011
*/
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 644 KB Partially correct
2 Partially correct 5 ms 808 KB Partially correct
3 Partially correct 5 ms 648 KB Partially correct
4 Partially correct 5 ms 652 KB Partially correct
5 Partially correct 5 ms 724 KB Partially correct
6 Partially correct 5 ms 724 KB Partially correct
7 Partially correct 5 ms 644 KB Partially correct
8 Partially correct 7 ms 652 KB Partially correct
9 Partially correct 6 ms 644 KB Partially correct
10 Partially correct 6 ms 632 KB Partially correct
11 Partially correct 6 ms 648 KB Partially correct
12 Partially correct 5 ms 648 KB Partially correct
13 Partially correct 5 ms 644 KB Partially correct
14 Partially correct 5 ms 644 KB Partially correct
15 Partially correct 5 ms 644 KB Partially correct
16 Partially correct 4 ms 644 KB Partially correct
17 Partially correct 5 ms 644 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 175 ms 2488 KB Partially correct
2 Partially correct 201 ms 2448 KB Partially correct
3 Partially correct 179 ms 2444 KB Partially correct
4 Partially correct 178 ms 2488 KB Partially correct
5 Partially correct 197 ms 2480 KB Partially correct
6 Partially correct 176 ms 2488 KB Partially correct
7 Partially correct 175 ms 2504 KB Partially correct
8 Partially correct 210 ms 2508 KB Partially correct
9 Partially correct 175 ms 2488 KB Partially correct
10 Partially correct 172 ms 2500 KB Partially correct
11 Partially correct 191 ms 2488 KB Partially correct
12 Partially correct 175 ms 2488 KB Partially correct
13 Partially correct 175 ms 2484 KB Partially correct
14 Partially correct 207 ms 2500 KB Partially correct
15 Partially correct 176 ms 2488 KB Partially correct
16 Partially correct 198 ms 2488 KB Partially correct
17 Partially correct 190 ms 2452 KB Partially correct
18 Partially correct 174 ms 2500 KB Partially correct
19 Partially correct 196 ms 2460 KB Partially correct