제출 #571859

#제출 시각아이디문제언어결과실행 시간메모리
571859RandomLBData Transfer (IOI19_transfer)C++17
컴파일 에러
0 ms0 KiB
#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;
  	vi res;
    for (int i = 0; i < ((int)v.size()==63?6:8); i++){
        res.push_back(xr&1);
        if (xr&1) on = 1-on;
      	xr >>= 1;
    }
    res.push_back(on);
    return res;
}
 
std::vector<int> retrieve(std::vector<int> v){
    int n = ((int)v.size() < 100? 63 : 255);
    int xr = 0;
    std::vector<int> 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;
}

컴파일 시 표준 에러 (stderr) 메시지

transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:8:4: error: 'vi' was not declared in this scope; did you mean 'v'?
    8 |    vi res;
      |    ^~
      |    v
transfer.cpp:10:9: error: 'res' was not declared in this scope
   10 |         res.push_back(xr&1);
      |         ^~~
transfer.cpp:14:5: error: 'res' was not declared in this scope
   14 |     res.push_back(on);
      |     ^~~