답안 #172857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172857 2020-01-02T16:54:57 Z maximath_1 벽 (IOI14_wall) C++11
100 / 100
1280 ms 147996 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e18;
ll stmax[8000888], stmin[8000888], h[8000888];
void down(ll idx, ll mn, ll mx){
	stmin[idx]=min(stmin[idx], mn);
	stmax[idx]=min(stmax[idx], mn);
	stmax[idx]=max(stmax[idx], mx);
}
void upd(ll cl, ll cr, ll lf, ll rg, ll nd, ll valmn, ll valmx){
	if(cl==cr) h[cl]=stmax[nd];
	else if(stmin[nd]!=inf || stmax[nd]!=0){
		down(nd*2, stmin[nd], stmax[nd]);
		down(nd*2+1, stmin[nd], stmax[nd]);
		stmin[nd]=inf;
		stmax[nd]=0;
	}
	if(cr<lf || rg<cl) return;
	else if(lf<=cl && cr<=rg)
		down(nd, valmn, valmx);
	else{
		upd(cl, (cl+cr)/2, lf, rg, nd*2, valmn, valmx);
		upd((cl+cr)/2+1, cr, lf, rg, nd*2+1, valmn, valmx);
	}
}
void buildWall(int n, int k, int op[], int lf[], int rg[], int H[], int fh[]){
	for(int i=1; i<=4*n; i++) stmin[i]=inf;
	for(int i=0; i<k; i++){
		if(op[i]==1)
			upd(0, n-1, lf[i], rg[i], 1, inf, H[i]);
		else
			upd(0, n-1, lf[i], rg[i], 1, H[i], 0);
	}
	for(int i=0; i<n; i++)
		upd(0, n-1, i, i, 1, inf, 0);
	for(int i=0; i<n; i++)
		fh[i]=h[i];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 10 ms 1272 KB Output is correct
5 Correct 9 ms 1272 KB Output is correct
6 Correct 9 ms 1276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 175 ms 8300 KB Output is correct
3 Correct 213 ms 4984 KB Output is correct
4 Correct 697 ms 24368 KB Output is correct
5 Correct 334 ms 25524 KB Output is correct
6 Correct 322 ms 23960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 10 ms 1272 KB Output is correct
5 Correct 9 ms 1272 KB Output is correct
6 Correct 9 ms 1272 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 177 ms 14152 KB Output is correct
9 Correct 226 ms 8696 KB Output is correct
10 Correct 690 ms 24412 KB Output is correct
11 Correct 331 ms 25568 KB Output is correct
12 Correct 324 ms 23980 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 177 ms 14020 KB Output is correct
15 Correct 40 ms 2680 KB Output is correct
16 Correct 696 ms 24712 KB Output is correct
17 Correct 329 ms 24184 KB Output is correct
18 Correct 327 ms 24052 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 11 ms 1272 KB Output is correct
5 Correct 9 ms 1272 KB Output is correct
6 Correct 9 ms 1272 KB Output is correct
7 Correct 7 ms 504 KB Output is correct
8 Correct 175 ms 13944 KB Output is correct
9 Correct 223 ms 8788 KB Output is correct
10 Correct 699 ms 24460 KB Output is correct
11 Correct 331 ms 25400 KB Output is correct
12 Correct 322 ms 24012 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 179 ms 14188 KB Output is correct
15 Correct 40 ms 2680 KB Output is correct
16 Correct 708 ms 24732 KB Output is correct
17 Correct 329 ms 24092 KB Output is correct
18 Correct 327 ms 24056 KB Output is correct
19 Correct 1249 ms 147828 KB Output is correct
20 Correct 1238 ms 145568 KB Output is correct
21 Correct 1252 ms 147904 KB Output is correct
22 Correct 1280 ms 145532 KB Output is correct
23 Correct 1222 ms 145700 KB Output is correct
24 Correct 1242 ms 145488 KB Output is correct
25 Correct 1231 ms 145604 KB Output is correct
26 Correct 1273 ms 147872 KB Output is correct
27 Correct 1244 ms 147996 KB Output is correct
28 Correct 1231 ms 145452 KB Output is correct
29 Correct 1235 ms 145468 KB Output is correct
30 Correct 1260 ms 145384 KB Output is correct