結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー 寝癖寝癖
提出日時 2024-02-23 22:20:39
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 842 ms / 2,500 ms
コード長 1,900 bytes
コンパイル時間 5,888 ms
コンパイル使用メモリ 320,876 KB
実行使用メモリ 40,084 KB
最終ジャッジ日時 2024-02-23 22:21:11
合計ジャッジ時間 27,431 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 3 ms
6,676 KB
testcase_02 AC 185 ms
12,544 KB
testcase_03 AC 67 ms
8,448 KB
testcase_04 AC 472 ms
28,928 KB
testcase_05 AC 361 ms
23,552 KB
testcase_06 AC 179 ms
13,568 KB
testcase_07 AC 424 ms
25,216 KB
testcase_08 AC 129 ms
10,496 KB
testcase_09 AC 780 ms
40,056 KB
testcase_10 AC 809 ms
40,084 KB
testcase_11 AC 842 ms
40,076 KB
testcase_12 AC 825 ms
40,076 KB
testcase_13 AC 840 ms
40,080 KB
testcase_14 AC 842 ms
40,080 KB
testcase_15 AC 806 ms
40,072 KB
testcase_16 AC 810 ms
40,080 KB
testcase_17 AC 792 ms
40,060 KB
testcase_18 AC 768 ms
40,084 KB
testcase_19 AC 836 ms
40,084 KB
testcase_20 AC 842 ms
40,084 KB
testcase_21 AC 816 ms
40,084 KB
testcase_22 AC 825 ms
40,084 KB
testcase_23 AC 628 ms
40,080 KB
testcase_24 AC 594 ms
40,084 KB
testcase_25 AC 617 ms
40,080 KB
testcase_26 AC 595 ms
40,084 KB
testcase_27 AC 616 ms
40,084 KB
testcase_28 AC 592 ms
40,084 KB
testcase_29 AC 623 ms
40,080 KB
testcase_30 AC 714 ms
40,056 KB
testcase_31 AC 636 ms
40,084 KB
testcase_32 AC 340 ms
15,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

template <class T> using Vec = vector<T>;
template <class T> using Graph = Vec<Vec<T>>;

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,n-1,-1)
#define rrepi(i,a,b) for(int i=int(a);i>int(b);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep)(__VA_ARGS__)

#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REVERSE(x) reverse(all(x))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int op(int a, int b) {
    return max(a, b);
}

int e() {
    return -1;
}

int mapping(int f, int x) {
    return max(f, x);
}

int composition(int f, int g) {
    return max(f, g);
}

int id() {
    return -1;
}

int main() {
    int N, A;
    cin >> N >> A;

    vi X(N);
    rep(i, N) cin >> X[i];

    int T;
    cin >> T;

    vi L(T), R(T);
    rep(i, T) cin >> L[i] >> R[i];

    set<int> S;
    for (auto x: X) S.insert(x);
    for (auto l: L) S.insert(l);
    for (auto r: R) S.insert(r);

    map<int, int> mp;
    int idx = 0;
    for (auto x: S) mp[x] = idx++;

    rep(i, N) X[i] = mp[X[i]];
    rep(i, T) L[i] = mp[L[i]];
    rep(i, T) R[i] = mp[R[i]];

    int M = S.size() + 1;
    lazy_segtree<int, op, e, int, mapping, composition, id> seg(M);

    rep(t, T) seg.apply(L[t], R[t]+1, t+1);
    for (auto x: X) cout << seg.get(x) << endl;
}
0