結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー 沙耶花
提出日時 2024-02-23 21:35:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 407 ms / 2,500 ms
コード長 684 bytes
コンパイル時間 5,475 ms
コンパイル使用メモリ 255,800 KB
最終ジャッジ日時 2025-02-19 19:32:42
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main(){
	
	int N,A;
	cin>>N>>A;
	set<pair<int,int>> S;
	rep(i,N){
		int x;
		cin>>x;
		S.emplace(x,i);
	}
	int T;
	cin>>T;
	vector<int> l(T),r(T);
	rep(i,T)cin>>l[i]>>r[i];
	vector<int> ans(N,-1);
	for(int i=T-1;i>=0;i--){
		auto it = S.lower_bound(make_pair(l[i],-1));
		while(it!=S.end()){
			if(it->first > r[i])break;
			ans[it->second] = i+1;
			it = S.erase(it);
		}
	}
	rep(i,N){
		cout<<ans[i]<<endl;
	}
	
	
	return 0;
}
0