답안 #292114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292114 2020-09-06T11:24:33 Z Autoratch Data Transfer (IOI19_transfer) C++14
100 / 100
428 ms 2804 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

int n,k;
int ret[10],mxk;
vector<int> s;

vector<int> get_attachment(vector<int> source)
{
    n = source.size();
    if(n==63) k = 6;
    else k = 8;
    for(int i = 0;i < k;i++) ret[i] = 0;
    for(int i = 1;i <= n;i++) for(int j = 0;j < k;j++) if(i&(1 << j)) ret[j]^=source[i-1];
    int all = 0;
    for(int i = 0;i < k;i++) all^=ret[i];
    vector<int> tmp;
    for(int i = 0;i < k;i++) tmp.push_back(ret[i]);
    tmp.push_back(all);
    return tmp;
}

vector<int> retrieve(vector<int> data)
{
    if(data.size()>200) n = 255,k = 8;
    else n = 63,k = 6;
    int all = 0;
    for(int i = n;i < data.size();i++) all^=data[i];
    if(all)
    {
        vector<int> tmp;
        for(int i = 0;i < n;i++) tmp.push_back(data[i]);
        return tmp;
    }
    for(int i = 0;i < k;i++) ret[i] = 0;
    int idx = 0;
    for(int i = 1;i <= n;i++) for(int j = 0;j < k;j++) if(i&(1 << j)) ret[j]^=data[i-1];
    for(int i = 0;i < k;i++) if(ret[i]!=data[i+n]) idx^=(1 << i);
    if(idx) data[idx-1]^=1;
    vector<int> tmp;
    for(int i = 0;i < n;i++) tmp.push_back(data[i]);
    return tmp;
}

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i = n;i < data.size();i++) all^=data[i];
      |                   ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1036 KB Output is correct
2 Correct 7 ms 1040 KB Output is correct
3 Correct 7 ms 1040 KB Output is correct
4 Correct 9 ms 1040 KB Output is correct
5 Correct 8 ms 1144 KB Output is correct
6 Correct 8 ms 1144 KB Output is correct
7 Correct 12 ms 1144 KB Output is correct
8 Correct 9 ms 1040 KB Output is correct
9 Correct 8 ms 1144 KB Output is correct
10 Correct 8 ms 1144 KB Output is correct
11 Correct 8 ms 932 KB Output is correct
12 Correct 7 ms 912 KB Output is correct
13 Correct 8 ms 912 KB Output is correct
14 Correct 8 ms 1148 KB Output is correct
15 Correct 8 ms 912 KB Output is correct
16 Correct 7 ms 1028 KB Output is correct
17 Correct 7 ms 912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 385 ms 2736 KB Output is correct
2 Correct 400 ms 2628 KB Output is correct
3 Correct 395 ms 2672 KB Output is correct
4 Correct 397 ms 2676 KB Output is correct
5 Correct 428 ms 2672 KB Output is correct
6 Correct 394 ms 2676 KB Output is correct
7 Correct 412 ms 2676 KB Output is correct
8 Correct 379 ms 2680 KB Output is correct
9 Correct 388 ms 2676 KB Output is correct
10 Correct 378 ms 2500 KB Output is correct
11 Correct 383 ms 2668 KB Output is correct
12 Correct 382 ms 2804 KB Output is correct
13 Correct 381 ms 2664 KB Output is correct
14 Correct 380 ms 2668 KB Output is correct
15 Correct 384 ms 2676 KB Output is correct
16 Correct 381 ms 2676 KB Output is correct
17 Correct 381 ms 2668 KB Output is correct
18 Correct 389 ms 2628 KB Output is correct
19 Correct 388 ms 2664 KB Output is correct