답안 #560612

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
560612 2022-05-11T17:48:44 Z MilosMilutinovic Data Transfer (IOI19_transfer) C++14
88 / 100
295 ms 2540 KB
#include "transfer.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> get_attachment(vector<int> source) {
  int n = source.size();
  vector<int> ret(9);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 8; j++) {
      if ((i + 1) >> j & 1) {
        ret[j] ^= source[i];
      }
    }
    ret[8] ^= source[i];
  }
  return ret;
}

vector<int> retrieve(vector<int> data) {
  int n = data.size();
  int f = 0;
  for (int i = 0; i < n - 9; i++) {
    f ^= data[i];
  }
  vector<int> ans(n - 9);
  for (int i = 0; i < n - 9; i++) {
    ans[i] = data[i];
  }
  if (f == data.back()) {
    return ans;
  }
  vector<int> r(8);
  for (int i = 0; i < n - 9; i++) {
    for (int j = 0; j < 8; j++) {
      if ((i + 1) >> j & 1) {
        r[j] ^= data[i];
      }
    }
  }
  int pos = 0;
  for (int i = 0; i < 8; i++) {
    if (r[i] != data[n - 9 + i]) {
      pos += (1 << i);
    }
  }
  if (pos != 0) {
    pos--;
    ans[pos] ^= 1;
  }
  return ans;
}

/*
5
0 011001010110110110100111110011010111111111111000101011100101001
7 011001010110110110100111110011010111111111111000101011100101001
62 011001010110110110100111110011010111111111111000101011100101001
63 011001010110110110100111110011010111111111111000101011100101001
-1 011001010110110110100111110011010111111111111000101011100101001

*/
# 결과 실행 시간 메모리 Grader output
1 Partially correct 4 ms 640 KB Partially correct
2 Partially correct 5 ms 644 KB Partially correct
3 Partially correct 6 ms 644 KB Partially correct
4 Partially correct 5 ms 644 KB Partially correct
5 Partially correct 5 ms 644 KB Partially correct
6 Partially correct 5 ms 736 KB Partially correct
7 Partially correct 5 ms 652 KB Partially correct
8 Partially correct 5 ms 724 KB Partially correct
9 Partially correct 6 ms 644 KB Partially correct
10 Partially correct 6 ms 644 KB Partially correct
11 Partially correct 5 ms 656 KB Partially correct
12 Partially correct 6 ms 652 KB Partially correct
13 Partially correct 6 ms 736 KB Partially correct
14 Partially correct 6 ms 644 KB Partially correct
15 Partially correct 5 ms 652 KB Partially correct
16 Partially correct 5 ms 652 KB Partially correct
17 Partially correct 6 ms 644 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 264 ms 2492 KB Output is correct
2 Correct 265 ms 2496 KB Output is correct
3 Correct 255 ms 2488 KB Output is correct
4 Correct 255 ms 2496 KB Output is correct
5 Correct 256 ms 2448 KB Output is correct
6 Correct 272 ms 2540 KB Output is correct
7 Correct 295 ms 2484 KB Output is correct
8 Correct 268 ms 2488 KB Output is correct
9 Correct 279 ms 2500 KB Output is correct
10 Correct 288 ms 2500 KB Output is correct
11 Correct 276 ms 2484 KB Output is correct
12 Correct 278 ms 2488 KB Output is correct
13 Correct 267 ms 2496 KB Output is correct
14 Correct 278 ms 2500 KB Output is correct
15 Correct 288 ms 2488 KB Output is correct
16 Correct 285 ms 2492 KB Output is correct
17 Correct 277 ms 2488 KB Output is correct
18 Correct 289 ms 2496 KB Output is correct
19 Correct 294 ms 2488 KB Output is correct