結果

問題 No.2687 所により大雨
ユーザー kotatsugamekotatsugame
提出日時 2024-03-20 21:51:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,011 bytes
コンパイル時間 697 ms
コンパイル使用メモリ 71,628 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 21:51:29
合計ジャッジ時間 3,385 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
6,676 KB
testcase_01 AC 35 ms
6,676 KB
testcase_02 AC 34 ms
6,676 KB
testcase_03 AC 35 ms
6,676 KB
testcase_04 AC 35 ms
6,676 KB
testcase_05 WA -
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 121 ms
6,676 KB
testcase_11 AC 117 ms
6,676 KB
testcase_12 AC 119 ms
6,676 KB
testcase_13 AC 147 ms
6,676 KB
testcase_14 AC 120 ms
6,676 KB
testcase_15 AC 118 ms
6,676 KB
testcase_16 AC 119 ms
6,676 KB
testcase_17 AC 119 ms
6,676 KB
testcase_18 AC 118 ms
6,676 KB
testcase_19 AC 117 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 6 ms
6,676 KB
testcase_25 AC 6 ms
6,676 KB
testcase_26 AC 6 ms
6,676 KB
testcase_27 AC 6 ms
6,676 KB
testcase_28 AC 6 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cassert>
using namespace std;
int N,M;
pair<int,int>LR[1<<17];
pair<int,int>nLR[1000];
int K;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>LR[i].first>>LR[i].second;
	for(int i=0;i<M;i++)cin>>nLR[i].first>>nLR[i].second;
	cin>>K;
	sort(LR,LR+N);
	{
		bool fn=false;
		for(int i=0;i+1<N;i++)if(LR[i].second>=LR[i+1].first)fn=true;
		if(fn)
		{
			for(;K--;)
			{
				int P;cin>>P;
				cout<<1<<(K?" ":"\n");
			}
			return 0;
		}
	}
	for(;K--;)
	{
		int P;cin>>P;
		bool fn=false;
		for(int i=0;i<M;i++)
		{
			long tL=nLR[i].first-P,tR=nLR[i].second-P;
			int l=-1,r=N;
			while(r-l>1)
			{
				int mid=(l+r)/2;
				if(P<=LR[mid].second+tR)r=mid;
				else l=mid;
			}
			for(int j:{r,r-1,r+1})if(j>=0&&j<N)
			{
				long ntL=max(tL,(long)P-LR[j].second);
				long ntR=min(tR,(long)P-LR[j].first);
				if(ntL<=ntR)
				{
					fn=true;
					break;
				}
			}
			if(fn)break;
		}
		cout<<fn<<(K?" ":"\n");
	}
}
0