結果
| 問題 |
No.2421 entersys?
|
| コンテスト | |
| ユーザー |
LaFolia13
|
| 提出日時 | 2023-07-29 18:23:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,143 bytes |
| コンパイル時間 | 2,721 ms |
| コンパイル使用メモリ | 207,760 KB |
| 実行使用メモリ | 101,384 KB |
| 最終ジャッジ日時 | 2024-10-08 06:30:12 |
| 合計ジャッジ時間 | 9,766 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 TLE * 1 -- * 17 |
コンパイルメッセージ
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:67:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
67 | for (auto &[id, ti, xlr]: que) {
| ^
main.cpp:92:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
92 | for (auto &[x, l, r]: xlr) {
| ^
main.cpp:97:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
97 | for (auto [key, val]: zaatsu) {
| ^
main.cpp:101:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
101 | for (auto &[id, ti, xlr]: que) {
| ^
main.cpp:102:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
102 | 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;
int r;
};
struct query {
int id;
int t;
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);
t.insert(l + 1);
t.insert(r + 1);
}
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);
t.insert(ti + 1);
t.insert(xlr.l + 1);
t.insert(xlr.r + 1);
}
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 [key, val]: zaatsu) {
cerr << key << " " << val << endl;
}
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