結果

問題 No.1625 三角形の質問
ユーザー tailstails
提出日時 2021-08-12 17:37:01
言語 cLay
(20240104-1)
結果
AC  
実行時間 534 ms / 6,000 ms
コード長 1,023 bytes
コンパイル時間 8,227 ms
コンパイル使用メモリ 223,960 KB
実行使用メモリ 83,544 KB
最終ジャッジ日時 2023-09-19 02:35:27
合計ジャッジ時間 20,455 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,544 KB
testcase_01 AC 23 ms
14,768 KB
testcase_02 AC 202 ms
32,840 KB
testcase_03 AC 118 ms
39,608 KB
testcase_04 AC 130 ms
28,028 KB
testcase_05 AC 247 ms
49,240 KB
testcase_06 AC 530 ms
70,656 KB
testcase_07 AC 519 ms
70,920 KB
testcase_08 AC 522 ms
70,776 KB
testcase_09 AC 533 ms
70,708 KB
testcase_10 AC 531 ms
70,712 KB
testcase_11 AC 523 ms
70,784 KB
testcase_12 AC 530 ms
70,656 KB
testcase_13 AC 534 ms
70,720 KB
testcase_14 AC 530 ms
70,756 KB
testcase_15 AC 521 ms
70,836 KB
testcase_16 AC 69 ms
30,960 KB
testcase_17 AC 246 ms
72,724 KB
testcase_18 AC 87 ms
48,136 KB
testcase_19 AC 273 ms
83,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

struct T {
	ll v;
	T(){
	}
	T(ll i){
		v=i;
	}
	void operator=(ll i){
		v=i;
	}
	void operator+=(T a){
		v>?=a.v;
	}
};

T operator-(T a,T b){
	return a;
}

bool operator<(T a,T b){
	return a.v<b.v;
}

rangeTree2d<T,int,int>t;

int dd1[2d5],dd2[];
T ww[];

struct Q {
	int t;
	ll l,r,s;
};
Q qs[1d5];

ll area(ll a,ll b,ll c,ll d,ll e,ll f){
	return abs((c-a)*(f-b)-(d-b)*(e-a));
}

int l_offs=int_inf;

{
	ll@n,@q;
	rep(i,n){
		ll@a,@b,@c,@d,@e,@f;
		ll l=min(a,c,e);
		ll r=max(a,c,e);
		ll s=area(a,b,c,d,e,f);
		dd1[i]=l_offs-l;
		dd2[i]=r;
		ww[i].v=s;
	}
	ll m=n;
	rep(i,q){
		ll@t;
		qs[i].t=t;
		if(t&1){
			ll@a,@b,@c,@d,@e,@f;
			ll l=min(a,c,e);
			ll r=max(a,c,e);
			ll s=area(a,b,c,d,e,f);
			dd1[m]=l_offs-l;
			dd2[m]=r;
			ww[m].v=0;
			++m;
			qs[i].l=l;
			qs[i].r=r;
			qs[i].s=s;
		}else{
			ll@l,@r;
			qs[i].l=l;
			qs[i].r=r;
		}
	}
	t.build(m,dd1,dd2,ww);
	rep(i,q){
		if(qs[i].t&1){
			t.add(l_offs-qs[i].l,qs[i].r,qs[i].s);
		}else{
			wt(t.query(0,l_offs-qs[i].l+1,0,qs[i].r+1).v?:-1);
		}
	}
}
0