Submission #1180863

#TimeUsernameProblemLanguageResultExecution timeMemory
1180863yusuf12360Skyscraper (JOI16_skyscraper)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define int long long #define ld long double #define pii pair<int, int> #define vi vector<int> #define vvi vector<vi> #define pb push_back #define fi first #define se second #define TII tuple<int, int, int> #define MT make_tuple #define mp make_pair #define ts to_string #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define lb lower_bound #define ub upper_bound #pragma GCC optimize("O3", "unroll-loops") using namespace std; const int MOD = 1e9 + 7, N = 105, K = 1e4 + 5; int dp[N][N][K][3]; bool interval(int a, int b, int c) { return a <= b && b <= c; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vi a(n + 2); for(int i = 1; i <= n; i++) cin >> a[i]; a[n + 1] = K; sort(all(a)); dp[0][0][0][0] = 1; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(i < j) continue; for(int k = 0; k < K; k++) { for(int l = 0; l <= 2; l++) { if(l > j) continue; dp[i][j][k][l] %= MOD; int d = (2 * j - l) * (a[i + 2] - a[i + 1]); // add new CC in the middle of the permutation if(k + d + 2 * (a[i + 2] - a[i + 1]) < K) dp[i + 1][j + 1][k + d + 2 * (a[i + 2] - a[i + 1])][l] += dp[i][j][k][l]; // add new CC in the end of the permutation if(k + d + (a[i + 2] - a[i + 1]) < K && l <= 1) dp[i + 1][j + 1][k + d + (a[i + 2] - a[i + 1])][l + 1] += (2 - l) * dp[i][j][k][l]; // connect i + 1 to the end of any CC but still in the middle of the permutation if(k + d < K) dp[i + 1][j][k + d][l] += (2 * j - l) * dp[i][j][k][l]; // connect i + 1 to the end of any CC and at the end of the permutation if(interval(0, k + d - (a[i + 2] - a[i + 1]), K - 1) && l <= 1) { dp[i + 1][j][k + d - (a[i + 2] - a[i + 1])][l + 1] += (2 - l) * (j - l) * dp[i][j][k][l]; // special case : i + 1 connect to a CC that has an end of a permutation if(i == n - 1 && j == 1 && l == 1) dp[i + 1][j][k + d - (a[i + 2] - a[i + 1])][l + 1] += dp[i][j][k][l]; } // connect 2 CC int mi = j - l, en = l; int conv = mi * en + mi * (mi - 1); if(i == n - 1 && mi == 0 && en == 2) conv++; if(interval(0, k + d - 2 * (a[i + 2] - a[i + 1]), K - 1) && j >= 2) dp[i + 1][j - 1][k + d - 2 * (a[i + 2] - a[i + 1])][l] += conv * dp[i][j][k][l]; } } } } int ans = 0; for(int k = 0; k <= m; k++) ans = (ans + dp[n][1][k][2] % MOD) % MOD; cout << ans << '\n'; return 0; }

Compilation message (stderr)

/tmp/ccFEF2PR.o: in function `main':
skyscraper.cpp:(.text.startup+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
skyscraper.cpp:(.text.startup+0x44): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
skyscraper.cpp:(.text.startup+0xa0d): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
/tmp/ccFEF2PR.o: in function `_GLOBAL__sub_I_dp':
skyscraper.cpp:(.text.startup+0xb08): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1c): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x67): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x87): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x92): additional relocation overflows omitted from the output
(.text._ZNSt8ios_base4InitC2Ev+0x1c6): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x260): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2e2): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x353): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x541): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5e5): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x670): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x6e9): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
collect2: error: ld returned 1 exit status