제출 #603368

#제출 시각아이디문제언어결과실행 시간메모리
603368SeDunionRectangles (IOI19_rect)C++17
컴파일 에러
0 ms0 KiB
#include "rect.h" #include<iostream> #include<vector> using namespace std; using ll = long long; const int N = 707; int gr[N][N][N]; int gc[N][N][N]; ll count_rectangles(vector<vector<int>>a) { int n = a.size(), m = a[0].size(); ll ans = 0; for (int r = 1 ; r < n - 1 ; ++ r) { for (int c1 = 1 ; c1 < m - 1 ; ++ c1) { int mx = 0; for (int c2 = c1 ; c2 < m - 1 ; ++ c2) { mx = max(mx, a[r][c2]); if (mx < a[r][c1 - 1] && mx < a[r][c2 + 1]) { gr[r][c1][c2] = 1; } } } } for (int c = 1 ; c < m - 1 ; ++ c) { for (int r1 = 1 ; r1 < n - 1 ; ++ r1) { int mx = 0; for (int r2 = r1 ; r2 < n - 1 ; ++ r2) { mx = max(mx, a[r2][c]); if (mx < a[r1 - 1][c] && mx < a[r2 + 1][c]) { gc[c][r1][r2] = 1; } } } } for (int r = 1 ; r < n - 1 ; ++ r) { for (int c1 = 1 ; c1 < m - 1 ; ++ c1) { for (int c2 = c1 ; c2 < m - 1 ; ++ c2) { gr[r][c1][c2] += gr[r-1][c1][c2]; } } } for (int c = 1 ; c < m - 1 ; ++ c) { for (int r1 = 1 ; r1 < n - 1 ; ++ r1) { for (int r2 = r1 ; r2 < n - 1 ; ++ r2) { gc[c][r1][r2] += gc[c-1][r1][r2]; } } } for (int r1 = 1 ; r1 < n - 1 ; ++ r1) { for (int r2 = r1 ; r2 < n - 1 ; ++ r2) { for (int c1 = 1 ; c1 < m - 1 ; ++ c1) { for (int c2 = c1 ; c2 < m - 1; ++ c2) { int sr = gr[r2][c1][c2] - gr[r1-1][c1][c2]; int sc = gc[c2][r1][r2] - gc[c1-1][r1][r2]; if (sr == r2 - r1 + 1 && sc == c2 - c1 + 1) { ans++; } } } } } return ans; }

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

/usr/lib/gcc/x86_64-linux-gnu/10/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/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status