結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
コンテスト
ユーザー 寝癖
提出日時 2024-02-23 21:58:24
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,880 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,650 ms
コンパイル使用メモリ 385,088 KB
実行使用メモリ 27,260 KB
最終ジャッジ日時 2026-04-15 16:56:54
合計ジャッジ時間 15,123 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other WA * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:70:11: warning: ignoring return value of 'constexpr _FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]', declared with attribute 'nodiscard' [-Wunused-result]
   70 |     unique(all(S));
      |     ~~~~~~^~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:63,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
                 from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algo.h:875:5: note: declared here
  875 |     unique(_ForwardIterator __first, _ForwardIterator __last)
      |     ^~~~~~

ソースコード

diff #
raw source code

#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))

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];

    vi S;
    for (auto x: X) S.emplace_back(x);
    for (auto l: L) S.emplace_back(l);
    for (auto r: R) S.emplace_back(r);
    unique(all(S));
    SORT(S);

    map<int, int> mp;
    rep(i, S.size()) mp[S[i]] = i;

    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) << " ";
    cout << endl;

}
0