結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー MagentorMagentor
提出日時 2024-02-23 22:07:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,544 bytes
コンパイル時間 5,921 ms
コンパイル使用メモリ 327,484 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2024-02-23 22:08:23
合計ジャッジ時間 17,671 ms
ジャッジサーバーID
(参考情報)
judge15 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 3 ms
6,548 KB
testcase_02 AC 124 ms
8,576 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 420 ms
17,152 KB
testcase_10 AC 408 ms
17,024 KB
testcase_11 AC 414 ms
17,152 KB
testcase_12 AC 408 ms
17,024 KB
testcase_13 AC 417 ms
17,024 KB
testcase_14 AC 423 ms
17,024 KB
testcase_15 AC 408 ms
17,024 KB
testcase_16 AC 351 ms
15,104 KB
testcase_17 AC 339 ms
15,104 KB
testcase_18 AC 356 ms
15,104 KB
testcase_19 AC 351 ms
15,104 KB
testcase_20 AC 349 ms
15,104 KB
testcase_21 AC 350 ms
15,104 KB
testcase_22 AC 351 ms
15,104 KB
testcase_23 AC 299 ms
15,104 KB
testcase_24 AC 301 ms
15,104 KB
testcase_25 AC 297 ms
15,104 KB
testcase_26 AC 300 ms
15,104 KB
testcase_27 AC 299 ms
15,104 KB
testcase_28 AC 299 ms
15,104 KB
testcase_29 AC 297 ms
15,104 KB
testcase_30 AC 347 ms
17,408 KB
testcase_31 AC 326 ms
18,944 KB
testcase_32 AC 241 ms
12,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, m ,n) for (int i = (m); i < (long long)(n); i++)
#define REP(i, n) for (long long i = 1; i < (long long)(n); i++)
typedef unsigned long long ll;
#define updiv(N,X) (N + X - 1) / X
#define l(n) n.begin(),n.end()
#define YesNo(Q) Q==1?cout<<"Yes":cout<<"No"
using P = pair<int, int>;
using mint = modint;
const int MOD = 998244353LL;
const ll INF = 999999999999LL;
vector<long long> fact, fact_inv, inv;
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
template <typename T>
void input(vector<T> &v){
 rep(i,v.size()){cin>>v[i];}
  return;
}
void init_nCk(int SIZE) {
    fact.resize(SIZE + 5);
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll POW(ll a,ll n){
  long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}
int main() {
ll n,as;cin>>n>>as;
vector<pair<ll,ll>> v(n);
rep(i,n){cin>>v[i].first;v[i].second=i;}
sort(l(v));
vector<ll> w(n);rep(i,n){w[i]=v[i].first;}
vector<vector<ll>> a(n+1);vector<vector<ll>> b(n+1);
int t;cin>>t;
rep(i,t){ll lt,r;cin>>lt>>r;r++;
	a[lower_bound(l(w),lt)-w.begin()].push_back(i+1);
	b[lower_bound(l(w),r)-w.begin()].push_back(i+1);
}
set<ll> st;
vector<ll> ans(n,-1);
rep(i,n){
rep(j,a[i].size()){st.insert(a[i][j]);}
rep(j,b[i].size()){st.erase(b[i][j]);}
if(st.size()==0){}
else{ans[v[i].second] = *rbegin(st);}
}
rep(i,n){
	if(n<ans[i]){cout<<-1<<endl;}
	else{cout << ans[i] << endl;}}

}
0