結果

問題 No.318 学学学学学
ユーザー ooaiu
提出日時 2024-09-09 11:50:12
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 3,339 ms
コンパイル使用メモリ 259,880 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-09-09 11:50:21
合計ジャッジ時間 8,038 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
#define cout std::cout
#define cin std::cin
#define endl '\n'
using ll = long long;
const ll inf = 1000000000000000000LL;
#include <atcoder/lazysegtree>
ll op(ll a, ll b) {
return 0 ^ a ^ a ^ b ^ b;
}
ll e() {
return 0;
}
ll mp(ll f, ll x) {
if(f == inf) return x;
return f;
}
ll cmp(ll f, ll g) {
if(f == inf) return g;
return f;
}
ll id() {
return inf;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
std::vector<ll> A(n);
for(int i = 0; i < n; i++) cin >> A[i];
std::map<int, std::vector<int>> C;
for(int i = 0; i < n; i++) C[A[i]].push_back(i);
atcoder::lazy_segtree<ll, op, e, ll, mp, cmp, id> seg(A);
for(auto it = C.begin(); it != C.end(); it++) {
std::vector<int> v = it->second;
int fi = v.front(), la = v.back();
seg.apply(fi, la + 1, it->first);
}
for(int i = 0; i < n; i++) cout << seg.get(i) << " ";
cout << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0