제출 #626810

#제출 시각아이디문제언어결과실행 시간메모리
626810typ_ik죄수들의 도전 (IOI22_prison)C++17
컴파일 에러
0 ms0 KiB
#include "prison.h"
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " : " << x << '\n'
#define int long long

using namespace std;

const int N = 5e3 + 1;
vector <int> notation[N];

bool inited;

vector <int> step3(int x) {
    vector <int> cur;

    for (int i = 0; i < 8; i++)
        cur.push_back(x % 3), x /= 3;

    return vector<int>(cur.rbegin(), cur.rend());
}

void init() {
    if (inited)
        return;
    inited = true;

    for (int i = 0; i < N; i++)
        notation[i] = step3(i);
}

vector<vector<int>> devise_strategy(int N) {
    init();

    vector < vector<int> > ans;

    ans.push_back({0});
    for (int i = 0; i < N; i++)
        ans.back().push_back(1+notation[i][0]);

    for (int p = 0; p < 8; p++) {
        for (int x = 0; x < 3; x++) {
            int isB = p & 1 ^ 1, isA = p & 1;

            ans.push_back({isB});

            for (int i = 0; i < N; i++)
                if (notation[i][p] != x) {
                    if (notation[i][p] > x) ans.back().push_back(-1 + -isA);
                        else ans.back().push_back(-1 + -isB);
                } else if (p + 1 < 8) {
                    ans.back().push_back(1+notation[i][p + 1] + 3 * (p + 1));
                } else {
                    ans.back().push_back(-1 + -isB);
                }
        }
    }

    return ans;
}

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

prison.cpp: In function 'std::vector<std::vector<long long int> > devise_strategy(long long int)':
prison.cpp:46:25: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   46 |             int isB = p & 1 ^ 1, isA = p & 1;
      |                       ~~^~~
/usr/bin/ld: /tmp/ccmBdPke.o: in function `main':
grader.cpp:(.text.startup+0x194): undefined reference to `devise_strategy(int)'
collect2: error: ld returned 1 exit status