結果
| 問題 |
No.2421 entersys?
|
| コンテスト | |
| ユーザー |
LaFolia13
|
| 提出日時 | 2023-07-29 18:34:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,530 ms / 3,000 ms |
| コード長 | 1,964 bytes |
| コンパイル時間 | 2,524 ms |
| コンパイル使用メモリ | 206,444 KB |
| 実行使用メモリ | 73,908 KB |
| 最終ジャッジ日時 | 2024-10-08 06:32:33 |
| 合計ジャッジ時間 | 26,118 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 28 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:58:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
58 | for (auto &[x, l, r]: xlr) {
| ^
main.cpp:65:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
65 | for (auto &[id, ti, xlr]: que) {
| ^
main.cpp:87:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
87 | for (auto &[x, l, r]: xlr) {
| ^
main.cpp:92:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
92 | for (auto &[id, ti, xlr]: que) {
| ^
main.cpp:93:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
93 | auto [x, l, r] = xlr;
| ^
ソースコード
#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
using namespace std;
using namespace atcoder;
using llong = long long;
using ldbl = long double;
using p = pair<int, int>;
#define ALL(x) x.begin(), x.end()
constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;
struct S {
int a;
};
struct F {
int a;
};
S op(S l, S r) { return S{min(l.a, r.a)}; }
S e() { return S{0}; }
S mapping(F l, S r) { return S{r.a + l.a}; }
F composition(F l, F r) { return F{r.a + l.a}; }
F id() { return F{0}; }
struct node {
string x;
int l = 0;
int r = 0;
};
struct query {
int id;
int t = 0;
node xlr;
};
map<int, int> zaatsu;
int z(int x) {
return zaatsu[x];
}
int main() {
int n, q;
vector<node> xlr;
vector<query> que;
set<int> t;
cin >> n;
xlr.resize(n);
for (auto &[x, l, r]: xlr) {
cin >> x >> l >> r;
t.insert(l);
t.insert(r);
}
cin >> q;
que.resize(q);
for (auto &[id, ti, xlr]: que) {
cin >> id;
if (id == 1) {
cin >> xlr.x >> ti;
}
else if (id == 2) {
cin >> ti;
}
else if (id == 3) {
cin >> xlr.x >> xlr.l >> xlr.r;
}
t.insert(ti);
t.insert(xlr.l);
t.insert(xlr.r);
}
for (auto &s: t) {
zaatsu[s] = zaatsu.size();
}
map<string, set<p>> st;
lazy_segtree<S, op, e, F, mapping, composition, id> seg(zaatsu.size() + 1);
xlr.resize(n);
for (auto &[x, l, r]: xlr) {
st[x].insert(p(z(r), z(l)));
seg.apply(z(l), z(r) + 1, F{1});
}
for (auto &[id, ti, xlr]: que) {
auto [x, l, r] = xlr;
if (id == 1) {
auto it = st[x].lower_bound(p(z(ti), 0));
if (it == st[x].end()) {
cout << "No" << endl;
}
else {
cout << (it->second <= z(ti) ? "Yes": "No") << endl;
}
}
else if (id == 2) {
cout << seg.get(z(ti)).a << endl;
}
else if (id == 3) {
st[x].insert(p(z(r), z(l)));
seg.apply(z(l), z(r) + 1, F{1});
}
}
return 0;
}
LaFolia13