Submission #127537

# Submission time Handle Problem Language Result Execution time Memory
127537 2019-07-09T14:06:27 Z nxteru Wall (IOI14_wall) C++14
100 / 100
812 ms 162576 KB
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define INF 100001
#define PB push_back
struct node{
	int d,u;
	void ini(void){
		d=0,u=INF;
	}
	node operator +(const node &q)const{
		if(d>=q.u)return node{q.u,q.u};
		else if(u<=q.d)return node{q.d,q.d};
		else return node{max(d,q.d),min(u,q.u)};
	}
};
struct SEG{
	node seg[1<<20];
	SEG(void){
		for(int i=0;i<1<<20;i++){
			seg[i].ini();
		}
	}
	void up(int a,node x){
		a+=(1<<19)-1;
		seg[a]=x;
		while(a>0){
			a=(a-1)/2;
			seg[a]=seg[a*2+1]+seg[a*2+2];
		}
	}
	int que(void){
		return seg[0].d;
	}
};
SEG seg;
vector<int>in[2000005],out[2000005];
void buildWall(int n,int k,int t[],int l[],int r[],int h[],int ans[]){
	for(int i=0;i<k;i++)in[l[i]].PB(i),out[r[i]+1].PB(i);
	for(int i=0;i<n;i++){
		for(int j=0;j<in[i].size();j++){
			int x=in[i][j];
			node p;
			p.ini();
			if(t[x]==1)p.d=h[x];
			else p.u=h[x];
			seg.up(x,p);
		}
		for(int j=0;j<out[i].size();j++){
			node p;
			p.ini();
			seg.up(out[i][j],p);
		}
		ans[i]=seg.que();
	}
}

Compilation message

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:41:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<in[i].size();j++){
               ~^~~~~~~~~~~~~
wall.cpp:49:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<out[i].size();j++){
               ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 95 ms 102392 KB Output is correct
2 Correct 98 ms 102628 KB Output is correct
3 Correct 98 ms 102520 KB Output is correct
4 Correct 103 ms 102964 KB Output is correct
5 Correct 100 ms 102904 KB Output is correct
6 Correct 101 ms 102904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 102512 KB Output is correct
2 Correct 318 ms 115564 KB Output is correct
3 Correct 319 ms 110696 KB Output is correct
4 Correct 704 ms 121828 KB Output is correct
5 Correct 390 ms 120472 KB Output is correct
6 Correct 383 ms 120028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 102468 KB Output is correct
2 Correct 97 ms 102660 KB Output is correct
3 Correct 98 ms 102604 KB Output is correct
4 Correct 102 ms 103004 KB Output is correct
5 Correct 101 ms 102948 KB Output is correct
6 Correct 101 ms 102876 KB Output is correct
7 Correct 97 ms 102504 KB Output is correct
8 Correct 317 ms 116348 KB Output is correct
9 Correct 274 ms 111440 KB Output is correct
10 Correct 804 ms 122076 KB Output is correct
11 Correct 387 ms 120424 KB Output is correct
12 Correct 382 ms 120152 KB Output is correct
13 Correct 97 ms 102408 KB Output is correct
14 Correct 353 ms 116400 KB Output is correct
15 Correct 158 ms 104532 KB Output is correct
16 Correct 812 ms 122504 KB Output is correct
17 Correct 447 ms 120036 KB Output is correct
18 Correct 446 ms 119640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 102504 KB Output is correct
2 Correct 99 ms 102732 KB Output is correct
3 Correct 98 ms 102596 KB Output is correct
4 Correct 104 ms 102912 KB Output is correct
5 Correct 101 ms 102904 KB Output is correct
6 Correct 102 ms 103036 KB Output is correct
7 Correct 95 ms 102528 KB Output is correct
8 Correct 318 ms 116408 KB Output is correct
9 Correct 275 ms 111200 KB Output is correct
10 Correct 798 ms 122152 KB Output is correct
11 Correct 389 ms 120404 KB Output is correct
12 Correct 386 ms 119928 KB Output is correct
13 Correct 103 ms 102648 KB Output is correct
14 Correct 355 ms 116156 KB Output is correct
15 Correct 132 ms 104564 KB Output is correct
16 Correct 809 ms 122260 KB Output is correct
17 Correct 444 ms 119800 KB Output is correct
18 Correct 460 ms 119416 KB Output is correct
19 Correct 734 ms 153464 KB Output is correct
20 Correct 733 ms 160028 KB Output is correct
21 Correct 718 ms 162576 KB Output is correct
22 Correct 715 ms 160104 KB Output is correct
23 Correct 711 ms 159968 KB Output is correct
24 Correct 711 ms 160080 KB Output is correct
25 Correct 703 ms 159992 KB Output is correct
26 Correct 716 ms 162336 KB Output is correct
27 Correct 716 ms 162500 KB Output is correct
28 Correct 708 ms 159860 KB Output is correct
29 Correct 705 ms 159924 KB Output is correct
30 Correct 722 ms 160048 KB Output is correct