답안 #475929

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475929 2021-09-24T13:12:14 Z qwerasdfzxcl Navigation 2 (JOI21_navigation2) C++17
컴파일 오류
0 ms 0 KB
#include "Bruno.h"
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

namespace {


} // namespace

std::vector<int> Bruno(int K, std::vector<int> value) {
    vector<int> ret(7);
    int pivot = -1;
    for (int i=0;i<9;i++) if (value[i]==13) pivot = i;
    assert(pivot!=-1);

    for (int i=-1, k=0;i<=1;i++){
        for (int j=-1;j<=1;j++, k++){
            int num = 0;
            num += (i-pivot/3+1)*3 + (j-pivot%3+1);
            num = (num+90)%9;
            if (num==0 || num==8) continue;
            num--;
            if (value[k]<=4) ret[num] = value[k]-1;
            else{
                int ex = -1e9, ey = -1e9;
                for (int x=-1, val=5;x<=1;x++){
                    for (int y=-1;y<=1;y++) if (x || y){
                        if (value[k]==val) ex = i+x, ey = j+y;
                        val++;
                    }
                }
                assert(ex!=-1e9 && ey!=-1e9);
                if (ex<0) ret[num] = 3;
                else if (ex>0) ret[num] = 2;
                else if (ey<0) ret[num] = 1;
                else if (ey>0) ret[num] = 0;
                else ret[num] = 4;
            }
        }
    }
    return ret;
}
#include "Bruno.h"
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

namespace {


} // namespace

std::vector<int> Bruno(int K, std::vector<int> value) {
    vector<int> ret(7);
    int pivot = -1;
    for (int i=0;i<9;i++) if (value[i]==13) pivot = i;
    assert(pivot!=-1);

    for (int i=-1, k=0;i<=1;i++){
        for (int j=-1;j<=1;j++, k++){
            int num = 0;
            num += (i-pivot/3+1)*3 + (j-pivot%3+1);
            num = (num+90)%9;
            if (num==0 || num==8) continue;
            num--;
            if (value[k]<=4) ret[num] = value[k]-1;
            else{
                int ex = -1e9, ey = -1e9;
                for (int x=-1, val=5;x<=1;x++){
                    for (int y=-1;y<=1;y++) if (x || y){
                        if (value[k]==val) ex = i+x, ey = j+y;
                        val++;
                    }
                }
                assert(ex!=-1e9 && ey!=-1e9);
                if (ex<0) ret[num] = 3;
                else if (ex>0) ret[num] = 2;
                else if (ey<0) ret[num] = 1;
                else if (ey>0) ret[num] = 0;
                else ret[num] = 4;
            }
        }
    }
    return ret;
}

Compilation message

/usr/bin/ld: /tmp/cc0YBKSy.o: in function `main':
grader_anna.cpp:(.text.startup+0x345): undefined reference to `Anna(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status