제출 #1152757

#제출 시각아이디문제언어결과실행 시간메모리
1152757gygRectangles (IOI19_rect)C++20
컴파일 에러
0 ms0 KiB
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
#define sig signed
#define int long long
#define arr array 
#define vec vector
#define pii pair<int, int>
#define fir first 
#define sec second
const int N = 700 + 5, M = 700 + 5;

int n, m;
arr<arr<int, M>, N> a;

arr<arr<arr<int, M>, M>, N> up, dwn, vld, fr;
void prcmp() {
	for (int j = 1; j <= m; j++) {
		vec<int> x;
		for (int i = n; i >= 1; i--) {
			while (x.size() && a[x.back()][j] <= a[i][j]) {
				up[x.back()][j][j] = i;
				x.pop_back();
			}
			x.push_back(i);
		}
		while (x.size()) {
			up[x.back()][j][j] = 0;
			x.pop_back();
		}
	}

	for (int j = 1; j <= m; j++) {
		vec<int> x;
		for (int i = 1; i <= n; i++) {
			while (x.size() && a[x.back()][j] <= a[i][j]) {
				dwn[x.back()][j][j] = i;
				x.pop_back();
			}
			x.push_back(i);
		}
		while (x.size()) {
			dwn[x.back()][j][j] = n + 1;
			x.pop_back();
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int l = 1; l <= m; l++) {
			int mx = -1;
			for (int r = l; r <= m; r++) {
				if (r != l) {
					up[i][l][r] = max(up[i][l][r - 1], up[i][r][r]);
					dwn[i][l][r] = min(dwn[i][l][r - 1], dwn[i][r][r]);
				}
				
				mx = max(mx, a[i][r]);
				if (l != 1 && r != m) vld[i][l][r] = (mx < min(a[i][l - 1], a[i][r + 1]));
			}
		}
	}

	for (int i = n; i >= 1; i--) {
		for (int l = 1; l <= m; l++) {
			for (int r = l; r <= m; r++) {
				fr[i][l][r] = n + 1;

				for (int j = i + 1; j <= n; j++) 
					if (!vld[j][l][r]) { fr[i][l][r] = j; break; }

				// cout << i << " " << l << " " << r << ": " << dwn[i][l][r] << " " << fr[i][l][r] << '\n';
			}
		}
	}
}

int cmp() {
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int l = 1; l <= m; l++) {
			for (int r = l; r <= m; r++) {
				int j = min({dwn[i][l][r], fr[i][l][r], n});
				if (j < i + 2) continue;

				// cout << i << " " << l << " " << r << ": " << i + 2 << " to " << j << '\n';

				for (int k = i + 2; k <= j; k++)
					ans += (up[k][l][r] <= i);
			}
		}
	}
	return ans;
}

int count_rectangles(vec<vec<sig>> _a) {
	n = _a.size(), m = _a[0].size();
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			a[i][j] = _a[i - 1][j - 1];

	prcmp();
	return cmp();
}
 

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

/tmp/ccTEFpxS.o: in function `cmp()':
rect.cpp:(.text+0xd): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x21): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x28): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x71): relocation truncated to fit: R_X86_64_PC32 against symbol `dwn' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0xc5): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccTEFpxS.o
/tmp/ccTEFpxS.o: in function `prcmp()':
rect.cpp:(.text+0x1b8): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x1e3): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x1ea): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x1f1): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x2ef): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccTEFpxS.o
rect.cpp:(.text+0x306): additional relocation overflows omitted from the output
/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+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