제출 #860873

#제출 시각아이디문제언어결과실행 시간메모리
860873vjudge1Xylophone (JOI18_xylophone)C++98
컴파일 에러
0 ms0 KiB
#include "xylophone.h" using namespace std; #define pb push_back #define mp make_pair #define mt make_tuple #define all(A) A.begin(), A.end() #define rall(A) A.rbegin(), A.rend() using ll = long long; using ld = long double; const int N = 1e5 + 5; const int M = 405; const int SQRT = 500; const int LOG = 20; const int INF = 1e9; const int MOD = 1e9+7; const ld EPS = 1e-9; const int BASE = 9973; int memo[N + 1][N + 1]; int ask(int l, int r) { if (memo[l][r] == -1) memo[l][r] = query(l, r); return memo[l][r]; } void solve(int n) { int l = 1, r = n; while (r - l > 1) { int mid = (l + r) / 2; if (query(mid, n) == n - 1)l = mid; else r = mid; } for(int i = 1;i<=n;i++){ for(int j = 1;j<=n;j++){ memo[i][j] = -1; } } int A[n+1]; A[l] = 1; A[l + 1] = 1 + ask(l, l + 1); if (l > 1) A[l - 1] = 1 + ask(l - 1, l); for (int i = l + 2;i<=n;i++) { int x = ask(i - 1, i); if (A[i - 1] - x < 1) { A[i] = A[i - 1] + x; continue; } if (A[i - 1] + x > n) { A[i] = A[i - 1] - x; continue; } if (A[i - 2] < A[i - 1]) { if (ask(i - 2, i) == ask(i - 2, i - 1))A[i] = A[i - 1] - ask(i - 1, i); else if (ask(i - 2, i) == ask(i - 1, i))A[i] = A[i - 1] - ask(i - 1, i); else A[i] = A[i - 1] + ask(i - 1, i); } else { if (ask(i - 2, i) == ask(i - 2, i - 1))A[i] = A[i - 1] + ask(i - 1, i); else if (ask(i - 2, i) == ask(i - 1, i))A[i] = A[i - 1] + ask(i - 1, i); else A[i] = A[i - 1] - ask(i - 1, i); } } for (int i = l - 2;i>=1;i--) { int x = ask(i, i + 1); if (A[i + 1] - x < 1) { A[i] = A[i + 1] + x; continue; } if (A[i + 1] + x > n) { A[i] = A[i + 1] - x; continue; } if (A[i + 2] < A[i + 1]) { if (ask(i, i + 2) == ask(i + 1, i + 2))A[i] = A[i + 1] - ask(i, i + 1); else if (ask(i, i + 2) == ask(i, i + 1))A[i] = A[i + 1] - ask(i, i + 1); else A[i] = A[i + 1] + ask(i, i + 1); } else { if (ask(i, i + 2) == ask(i + 1, i + 2))A[i] = A[i + 1] + ask(i, i + 1); else if (ask(i, i + 2) == ask(i, i + 1))A[i] = A[i + 1] + ask(i, i + 1); else A[i] = A[i + 1] - ask(i, i + 1); } } for (int i = 1;i<=n;i++)answer(i, A[i]); }

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

/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libc.a(assert.o): in function `__assert_fail_base':
(.text+0x114): relocation truncated to fit: R_X86_64_PC32 against symbol `__abort_msg' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libc.a(abort.o)
/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libc.a(loadmsgcat.o): in function `_nl_load_domain':
(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x5a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x67): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x73): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x48a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x4a1): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x4ac): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x4c2): relocation truncated to fit: R_X86_64_PC32 against `.bss'
(.text+0x510): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status