제출 #1067153

#제출 시각아이디문제언어결과실행 시간메모리
1067153idas던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
#include "dungeons.h"

#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define sz(x) ((int)(x).size())
#define pb push_back
#define s second
#define f first

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const ll MAX=1e15;
const int N=4e5, LG=24, EL=20;
int n, s[N], p[N], w[N], l[N], b[LG][EL][N];
ll sm[LG][EL][N];

void init(int N, std::vector<int> S, std::vector<int> P, std::vector<int> W, std::vector<int> L) {
    n=N;
    FOR(i, 0, n) s[i]=S[i], p[i]=P[i], w[i]=W[i], l[i]=L[i];
    FOR(i, 0, LG) {
        FOR(k, 0, n) {
            if((1<<i)>=s[k]) {
                b[i][0][k]=w[k];
                sm[i][0][k]=s[k];
            }
            else {
                b[i][0][k]=l[k];
                sm[i][0][k]=p[k];
            }
        }
        b[i][0][n]=n;
    }
    FOR(i, 1, EL) {
        FOR(j, 0, LG) {
            FOR(k, 0, n+1) {
                b[j][i][k]=b[j][i-1][b[j][i-1][k]];
                sm[j][i][k]=sm[j][i-1][k]+sm[j][i-1][b[j][i-1][k]];
                sm[j][i][k]=min(sm[j][i][k], MAX);
            }
        }
    }
}

long long simulate(int x, int Z) {
    ll z=Z;
    int in=0;
    FOR(i, 1, EL) if(z>=(1<<i)) in=i;
    while(in<EL-1) {
        for(int i=EL-1; i>=0; i--) {
            if(z+sm[in][i][x]<(1<<(in+1))) {
                z+=sm[in][i][x];
                x=b[in][i][x];
            }
        }
        z+=sm[in][0][x];
        x=b[in][0][x];
        if(x==n) return z;
        while(in<EL-1 && z>=(1<<(in+1))) in++;
    }
    return z+sm[in][EL-1][x];
}
/*
3 1
3 3 3
2 1 1
1 2 3
1 0 3
2 237894

3 2
2 6 9
3 1 2
2 2 3
1 0 1
0 2
2 0

5 1
3 3 1 2 2
1 1 1 1 2
1 2 3 4 5
1 2 0 4 3
4 10000000

4 2
2 4 3 8
2 4 3 8
1 3 3 4
1 0 1 4
0 0
3 4
*/

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

/tmp/cc0jseKA.o: in function `main':
grader.cpp:(.text.startup+0x178): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x17f): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x19d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1a4): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1b0): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1b7): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1c3): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1ca): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1d6): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1dd): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1e9): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status