답안 #571848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
571848 2022-06-02T21:52:05 Z RandomLB Data Transfer (IOI19_transfer) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

std::vector<int> get_attachment(std::vector<int> v){
    int xr = 0;
    for (int i = 0; i < (int)v.size(); i++) xr ^= (i+1)*v[i];
    int on = 0;
    for (int i = 0; i < ((int)v.size()==63?6:8); i++){
        v.push_back(xr&(1<<i)?1:0);
        if (xr&(1<<i)) on ^= 1;
    }
    v.push_back(on);
    return v;
}

std::vector<int> retrieve(std::vector<int> v){
    int n = ((int)v.size() < 100? 63 : 255);
    int xr = 0;
    vi res;
    for (int i = 0; i < n; i++){
        xr ^= (i+1)*v[i];
        res.push_back(v[i]);
    }
    int check = 0, on = 0;
    for (int i = 0; i < (n==63?6:8); i++){
        if (v[n+i]){
            check ^= (1<<i);
            on ^= 1;
        }
    }
    if (xr != check && on == v.back()) res[(xr^check)-1] ^= 1;
    return res;
}

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:19:5: error: 'vi' was not declared in this scope; did you mean 'v'?
   19 |     vi res;
      |     ^~
      |     v
transfer.cpp:22:9: error: 'res' was not declared in this scope
   22 |         res.push_back(v[i]);
      |         ^~~
transfer.cpp:31:40: error: 'res' was not declared in this scope
   31 |     if (xr != check && on == v.back()) res[(xr^check)-1] ^= 1;
      |                                        ^~~
transfer.cpp:32:12: error: 'res' was not declared in this scope
   32 |     return res;
      |            ^~~