Submission #554600

# Submission time Handle Problem Language Result Execution time Memory
554600 2022-04-28T21:58:57 Z urosk Data Transfer (IOI19_transfer) C++14
100 / 100
103 ms 2500 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;}
#define here cerr<<"============\n";
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]==1) x^=1;
    }
    ans.pb(x);
    x = 0;
    ll nn = n+1;
    ll d =0;
    while(nn>0){
        nn/=2;
        d++;
    }
    d--;
    for(ll i = 0;i<n;i++){
        if(a[i]==1) x^=(i+1);
    }
    //cerr<<x<<endl;
    //acerr<<d<<" "<<x<<endl;
    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;
    if(m==11) n = 7;
    else if(m==70) n = 63;
    else n = 255;
    //cerr<<n<<" "<<m<<endl;
    vector<int> ans;
    ll x = 0;
    for(ll i = n+1;i<sz(a);i++){
        x+=a[i]*(1<<(i-n-1));
    }
    ll y = 0;
    ll z = 0;
    for(ll i = 0;i<n;i++){
        ans.pb(a[i]);
        if(a[i]==1){
            y^=(i+1);
            z^=1;
        }
    }
    if(a[n]==z) return ans;
    if(x==y) return ans;
    //here;
    //cerr<<x<< " "<<y<<endl;
    x^=y;
    x--;
    ans[x]^=1;
    return ans;
}
/*
1
4 010101011
*/
# Verdict Execution time Memory Grader output
1 Correct 3 ms 648 KB Output is correct
2 Correct 4 ms 652 KB Output is correct
3 Correct 4 ms 644 KB Output is correct
4 Correct 4 ms 652 KB Output is correct
5 Correct 4 ms 644 KB Output is correct
6 Correct 4 ms 652 KB Output is correct
7 Correct 4 ms 648 KB Output is correct
8 Correct 4 ms 732 KB Output is correct
9 Correct 4 ms 644 KB Output is correct
10 Correct 4 ms 740 KB Output is correct
11 Correct 4 ms 640 KB Output is correct
12 Correct 4 ms 744 KB Output is correct
13 Correct 4 ms 744 KB Output is correct
14 Correct 4 ms 644 KB Output is correct
15 Correct 4 ms 640 KB Output is correct
16 Correct 4 ms 652 KB Output is correct
17 Correct 4 ms 736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 2488 KB Output is correct
2 Correct 96 ms 2496 KB Output is correct
3 Correct 99 ms 2452 KB Output is correct
4 Correct 103 ms 2448 KB Output is correct
5 Correct 97 ms 2488 KB Output is correct
6 Correct 95 ms 2488 KB Output is correct
7 Correct 95 ms 2444 KB Output is correct
8 Correct 95 ms 2496 KB Output is correct
9 Correct 96 ms 2488 KB Output is correct
10 Correct 93 ms 2496 KB Output is correct
11 Correct 92 ms 2452 KB Output is correct
12 Correct 97 ms 2496 KB Output is correct
13 Correct 100 ms 2496 KB Output is correct
14 Correct 93 ms 2488 KB Output is correct
15 Correct 92 ms 2500 KB Output is correct
16 Correct 95 ms 2460 KB Output is correct
17 Correct 99 ms 2492 KB Output is correct
18 Correct 98 ms 2500 KB Output is correct
19 Correct 95 ms 2496 KB Output is correct