제출 #800441

#제출 시각아이디문제언어결과실행 시간메모리
800441MohamedAliSaidane던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> //#include "dungeons.h" using namespace std; typedef vector<int> vi; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> pll; typedef pair<int,int> pii; #define ff first #define ss second #define pb push_back #define all(x) (x).begin(),(x).end() const int nax = 4e5 + 5; const ll INF = 1e7; const int LG = 25; const int LG2 = 11; const int b = 5; int n; vi S, P, W, L; int sp[nax][LG2][LG]; ll mini[nax][LG2][LG]; ll ps[nax][LG2][LG]; ll POW[LG2]; void init(int N, vi s, vi p, vi w, vi l) { n = N, S = s, P = p, W= w, L = l; S.pb(0); W.pb(n); POW[0] = 1ll; for(int i =1; i < LG2; i++) POW[i] = (POW[i - 1] * 1ll * b); for(int i = 0; i <= n; i++) { for(int l = 0; l < LG2; l++) { if(S[i] <= POW[l]) { sp[i][l][0] = W[i]; mini[i][l][0] = INF * 1ll * INF; ps[i][l][0] = S[i]; } else { sp[i][l][0] = L[i]; mini[i][l][0] = S[i]; ps[i][l][0] = P[i]; } } } for(int j = 1; j < LG; j++) { for(int i = 0; i <= n; i++) { for(int l = 0; l < LG2; l++) { sp[i][l][j] = sp[sp[i][l][j - 1]][l][j - 1]; mini[i][l][j] = min(mini[i][l][j - 1], mini[sp[i][l][j - 1]][l][j - 1] - ps[i][l][j - 1]); ps[i][l][j] = ps[i][l][j - 1] + ps[sp[i][l][j - 1]][l][j - 1]; } } } } pair<int,ll> check(int i, ll z) { ll delta = 0ll; int l = 0; while((l < LG2) && POW[l] <= z) l++; l--; if((S[i] > POW[l]) && (S[i] <= z)) return {i, 0ll}; //cout << '\t' << i << ' ' << z << ' ' << l << '\n'; for(int j = LG - 1; j >= 0; j--) { bool cond = (mini[i][l][j] - delta <= z) || (sp[i][l][j] == n); if(!(cond)) { delta += ps[i][l][j]; i = sp[i][l][j]; } } if(z + delta < mini[i][l][0]) { delta += ps[i][l][0]; i = sp[i][l][0]; } return {i, delta}; } ll simulate(int x, int Z) { ll z = Z; while(x != n) { // cout << x << ' ' << z << '\n'; pair<int,ll> u = check(x, z); x = u.ff; z += u.ss; z += S[x]; x = W[x]; } return z; } /* int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); /* int n, q; cin >> n >> q; vi s(n), p(n), w(n), l(n); for(int i = 0; i < n; i++) cin >> s[i]; for(int i = 0; i < n; i++) cin >> p[i]; for(int i =0 ;i < n; i++) cin >> w[i]; for(int i = 0;i < n; i++) cin >> l[i]; init(n, s, p, w, l); while(q--) { int x, z; cin >> x >> z; cout << simulate(x, z) << '\n'; } init(3, {2, 6, 9}, {3, 1, 2}, {2, 2, 3}, {1, 0, 1}); cout << simulate(0, 1) << '\n'; cout << simulate(2, 3) << '\n'; } */

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

dungeons.cpp:113:5: warning: "/*" within comment [-Wcomment]
  113 |     /*
      |      
/tmp/ccD9wzna.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