답안 #361899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361899 2021-01-31T23:20:15 Z iliccmarko Data Transfer (IOI19_transfer) C++14
0 / 100
3 ms 1132 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, cnt^=1;
        ind++;
    }
    int w = 6;
    if(len(a)==255) w = 8;
    for(int i = 0;i<w;i++)
    {
        int bit = (xorr>>i)&1;
        r.pb(bit);
    }
    r.pb(cnt);
}

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;
}

Compilation message

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
   35 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1132 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -