結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー kotatsugame
提出日時 2024-02-23 21:28:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 117 ms / 2,500 ms
コード長 550 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 73,960 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2024-09-29 05:29:57
合計ジャッジ時間 5,699 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<set>
#include<cassert>
using namespace std;
int ans[1<<17];
int N,A,T,L[1<<17],R[1<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>A;
	set<pair<int,int> >S;
	for(int i=0;i<N;i++)
	{
		ans[i]=-1;
		int x;cin>>x;
		S.insert(make_pair(x,i));
	}
	cin>>T;
	for(int t=1;t<=T;t++)cin>>L[t]>>R[t];
	for(int t=T;t>=1;t--)
	{
		auto it=S.lower_bound(make_pair(L[t],0));
		while(it!=S.end()&&it->first<=R[t])
		{
			ans[it->second]=t;
			it=S.erase(it);
		}
	}
	for(int i=0;i<N;i++)cout<<ans[i]<<"\n";
}
0