제출 #1215386

#제출 시각아이디문제언어결과실행 시간메모리
1215386brintonSplit the Attractions (IOI19_split)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "rect.h"
using namespace std;

long long count_rectangles(vector<vector<int> > a) {
	int N = a[0].size();
	vector<int> bad(N,0);
	for(int i = 1;i < N-1;i++){
		if(a[1][i] < a[0][i] && a[1][i] < a[2][i]){
			bad[i] = false;
		}else{
			bad[i] = true;
		}
	}
	for(int i = 1;i < N;i++){
		bad[i] += bad[i-1];
	}
	// sparse table;
	int k = __lg(N)+1;
	vector<vector<int>> spt(k,vector<int>(N));
	spt[0] = a[1];
	for(int layer = 1;layer < k;layer++){
		for(int s = 0;s+(1 << layer)-1 < N;s++){
			spt[layer][s] = max(spt[layer-1][s],spt[layer-1][s+(1 << (layer-1))]);
		}
	}
	auto ask = [&](int l,int r){
		int len = r-l+1;
		int layer = __lg(len);
		return max(spt[layer][l],spt[layer][r-(1 << layer)+1]);
	};


	long long ans = 0;
	for(int l = 0;l < N;l++){
		int cmax = a[l+1];
		for(int r = l+2;r < N;r++){
			// int midmax = ask(l+1,r-1);
			int midmax = cmax;
			// cout << "(" << l << "," << r << "):" << midmax << "," << bad[r-1]-bad[l] << endl;
			if(midmax < a[1][l] && midmax < a[1][r] && bad[r-1]-bad[l] == 0){
				ans++;
			}
			cmax = max(cmax,a[1][r]);
		}
	}
	return ans;
}

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

split.cpp:2:10: fatal error: rect.h: No such file or directory
    2 | #include "rect.h"
      |          ^~~~~~~~
compilation terminated.