結果

問題 No.2687 所により大雨
ユーザー 沙耶花沙耶花
提出日時 2024-03-20 22:13:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,621 bytes
コンパイル時間 6,529 ms
コンパイル使用メモリ 267,092 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 22:14:12
合計ジャッジ時間 26,660 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
6,676 KB
testcase_01 AC 33 ms
6,676 KB
testcase_02 AC 33 ms
6,676 KB
testcase_03 AC 34 ms
6,676 KB
testcase_04 AC 33 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
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 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
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 2 ms
6,676 KB
testcase_25 AC 3 ms
6,676 KB
testcase_26 AC 3 ms
6,676 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 AC 3 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001
using P = pair<long long,long long>;

int main(){
	
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	
	int N,M;
	cin>>N>>M;
	vector<P> i0(N),i1(M);
	rep(i,N){
		cin>>i0[i].first>>i0[i].second;
		rep(j,4){
			i0[i].first -= Inf32;
			i0[i].second -= Inf32;
		}
		i0[i].first *= 2;
		i0[i].second *= 2;
	}
	rep(i,M){
		cin>>i1[i].first>>i1[i].second;
		rep(j,4){
			i1[i].first += Inf32;
			i1[i].second += Inf32;
		}
		i1[i].first *= 2;
		i1[i].second *= 2;
	}
	sort(i0.begin(),i0.end());
	sort(i1.begin(),i1.end());
	
	int K;
	cin>>K;
	vector<long long> p(K);
	rep(i,K){
		cin>>p[i];
		p[i] *= 2;
	}
	
	rep(i,i0.size()){
		if(i>=1 && i0[i].first <= i0[i-1].second){
			rep(j,K){
				if(j!=0)cout<<' ';
				cout<<1;
			}
			cout<<endl;
			return 0;
		}
	}
	rep(i,i1.size()){
		if(i>=1 && i1[i].first <= i1[i-1].second){
			rep(j,K){
				if(j!=0)cout<<' ';
				cout<<1;
			}
			cout<<endl;
			return 0;
		}
	}
	
	vector<int> ans(K+1);
	
	rep(i,N){
		rep(j,M){
			long long A = (i0[i].first + i1[j].first)/2;
			long long B = (i0[i].second + i1[j].second)/2;
			if(A>B)swap(A,B);
			int d;
			d = distance(p.begin(),lower_bound(p.begin(),p.end(),A));
			ans[d]++;
			d = distance(p.begin(),upper_bound(p.begin(),p.end(),B));
			ans[d]--;
		}
	}
	rep(i,K){
		ans[i+1] += ans[i];
		if(i!=0)cout<<' ';
		if(ans[i]>0)cout<<1;
		else cout<<0;
	}
	cout<<endl;
	
	return 0;
}
0