Submission #711058

# Submission time Handle Problem Language Result Execution time Memory
711058 2023-03-16T07:52:21 Z Pring Data Transfer (IOI19_transfer) C++14
Compilation error
0 ms 0 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> get_attachment(vector<int> source) {
    int n = source.size();
    vector<int> modify(n + 9);
    int x = 0, y = 0;
    for (int i = 0; i < n; i++) {
        modify[i] = source[i];
        if (modify[i]) x |= (i + 1);
    }
    for (int i = 0; i < 8; i++) {
        modify[n + i] = (bool) (x | (1 << i));
        if (modify[n + i]) y ^= 1;
    }
    modify.back() = y;
    return modify;
}

vector<int> retrieve(vectot<int> data) {
    int n = data.size() - 9;
    vector<int> ans(n);
    for (int i = 0; i < n; i++) ans[i] = data[i];
    int x = 0, y = 0;
    for (int i = 0; i < 8; i++) {
        if (data[n + i]) {
            x += (1 << i);
            y ^= 1;
        }
    }
    if (y != data.back()) return ans;
    for (int i = 0; i < n; i++) {
        if (ans[i]) x |= i + 1;
    }
    if (x == 0) return ans;
    ans[x - 1] ^= 1;
    return ans;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> v(n);
    for (int i = 0; i < n; i++) v[i] = s[i] & 1;
    vector<int> w = retrieve(get_attachment)
}

Compilation message

transfer.cpp:21:22: error: 'std::vector<int> retrieve' redeclared as different kind of entity
   21 | vector<int> retrieve(vectot<int> data) {
      |                      ^~~~~~
In file included from transfer.cpp:1:
transfer.h:6:18: note: previous declaration 'std::vector<int> retrieve(std::vector<int>)'
    6 | std::vector<int> retrieve(std::vector<int> data);
      |                  ^~~~~~~~
transfer.cpp:21:22: error: 'vectot' was not declared in this scope
   21 | vector<int> retrieve(vectot<int> data) {
      |                      ^~~~~~
transfer.cpp:21:29: error: expected primary-expression before 'int'
   21 | vector<int> retrieve(vectot<int> data) {
      |                             ^~~
transfer.cpp: In function 'int main()':
transfer.cpp:47:30: error: could not convert 'get_attachment' from 'std::vector<int> (*)(std::vector<int>)' to 'std::vector<int>'
   47 |     vector<int> w = retrieve(get_attachment)
      |                              ^~~~~~~~~~~~~~
      |                              |
      |                              std::vector<int> (*)(std::vector<int>)
transfer.cpp:48:1: error: expected ',' or ';' before '}' token
   48 | }
      | ^