답안 #361901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361901 2021-01-31T23:49:00 Z iliccmarko Data Transfer (IOI19_transfer) C++14
100 / 100
190 ms 2732 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define single_case solve();
#define line cerr<<"----------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); }
#define mod 1000000007LL

vector<int> get_attachment(vector<int> a)
{
    vector<int> r;
    int xorr = 0;
    int ind = 1;
    int cnt = 0;
    for(int x : a)
    {
        if(x) xorr^=ind;
        ind++;
    }
    int w = 6;
    if(len(a)==255) w = 8;
    for(int i = 0;i<w;i++)
    {
        int bit = (xorr>>i)&1;
        if(bit) cnt^=1;
        r.pb(bit);
    }
    r.pb(cnt);
    return r;
}

vector<int> retrieve(vector<int> a)
{
    int l = 63;
    int poc = 63;
    int w = 6;
    if(len(a)>80) l = 255, poc = 255, w = 8;
    int xor1, xor2;
    xor1 = xor2 = 0;
    for(int i = 0;i<l;i++) if(a[i]) xor1^=(i+1);
    int cnt = 0;
    for(int i = poc;i-poc<w;i++)
    {
        int bit = a[i];
        if(bit) cnt^=1;
        xor2+=bit*(1<<(i-poc));
    }
    vector<int> r;
    if(xor1==xor2)
    {
        for(int i = 0;i<l;i++) r.pb(a[i]);
        return r;
    }
    if(cnt!=a[len(a)-1])
    {
        for(int i = 0;i<l;i++) r.pb(a[i]);
        return r;
    }
    int p = xor1^xor2;
    for(int i = 0;i<l;i++)
    {
        if(p==i+1) r.pb(a[i]^1);
        else r.pb(a[i]);
    }
    return r;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1220 KB Output is correct
2 Correct 5 ms 880 KB Output is correct
3 Correct 5 ms 880 KB Output is correct
4 Correct 5 ms 880 KB Output is correct
5 Correct 5 ms 1092 KB Output is correct
6 Correct 5 ms 1008 KB Output is correct
7 Correct 6 ms 1008 KB Output is correct
8 Correct 6 ms 1092 KB Output is correct
9 Correct 5 ms 880 KB Output is correct
10 Correct 5 ms 1048 KB Output is correct
11 Correct 5 ms 1008 KB Output is correct
12 Correct 5 ms 1008 KB Output is correct
13 Correct 5 ms 1008 KB Output is correct
14 Correct 6 ms 1136 KB Output is correct
15 Correct 5 ms 880 KB Output is correct
16 Correct 5 ms 880 KB Output is correct
17 Correct 5 ms 1100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 128 ms 2464 KB Output is correct
2 Correct 129 ms 2612 KB Output is correct
3 Correct 131 ms 2468 KB Output is correct
4 Correct 137 ms 2468 KB Output is correct
5 Correct 175 ms 2640 KB Output is correct
6 Correct 190 ms 2604 KB Output is correct
7 Correct 165 ms 2468 KB Output is correct
8 Correct 136 ms 2612 KB Output is correct
9 Correct 123 ms 2656 KB Output is correct
10 Correct 122 ms 2732 KB Output is correct
11 Correct 121 ms 2468 KB Output is correct
12 Correct 129 ms 2648 KB Output is correct
13 Correct 131 ms 2596 KB Output is correct
14 Correct 135 ms 2604 KB Output is correct
15 Correct 138 ms 2468 KB Output is correct
16 Correct 141 ms 2596 KB Output is correct
17 Correct 134 ms 2468 KB Output is correct
18 Correct 132 ms 2604 KB Output is correct
19 Correct 132 ms 2604 KB Output is correct