Submission #711010

# Submission time Handle Problem Language Result Execution time Memory
711010 2023-03-16T07:10:06 Z becaido Data Transfer (IOI19_transfer) C++17
60 / 100
3000 ms 2444 KB
#include <bits/stdc++.h>
#include "transfer.h"
using namespace std;

vector<int> get_attachment(vector<int> source) {
	int n = source.size();
	vector<int> val(__lg(n + 1) + 1);
	for (int i = 1, cnt = 0; cnt < n; i++) if (__builtin_popcount(i) > 1) {
        if (source[cnt]) {
            for (int j = 0; j <= __lg(n + 1); j++) {
                val[j] ^= i >> j & 1;
            }
        }
        cnt++;
	}
	return val;
}

vector<int> retrieve(vector<int> data) {
    int n = data.size();
    n = (n == 70 ? 63 : 255);
    vector<int> val;
    while (data.size() > n) {
        val.emplace_back(data.back());
        data.pop_back();
    }
    reverse(val.begin(), val.end());
    if (get_attachment(data) == val) return data;
    for (int &x : data) {
        x ^= 1;
        if (get_attachment(data) == val) return data;
        x ^= 1;
    }
    return data;
}

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:23:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     while (data.size() > n) {
      |            ~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 62 ms 644 KB Output is correct
2 Correct 62 ms 652 KB Output is correct
3 Correct 66 ms 648 KB Output is correct
4 Correct 78 ms 656 KB Output is correct
5 Correct 83 ms 644 KB Output is correct
6 Correct 97 ms 736 KB Output is correct
7 Correct 110 ms 644 KB Output is correct
8 Correct 108 ms 664 KB Output is correct
9 Correct 97 ms 712 KB Output is correct
10 Correct 101 ms 652 KB Output is correct
11 Correct 104 ms 740 KB Output is correct
12 Correct 105 ms 628 KB Output is correct
13 Correct 89 ms 652 KB Output is correct
14 Correct 99 ms 652 KB Output is correct
15 Correct 101 ms 648 KB Output is correct
16 Correct 87 ms 648 KB Output is correct
17 Correct 93 ms 652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3062 ms 2444 KB Time limit exceeded
2 Halted 0 ms 0 KB -