結果

問題 No.2421 entersys?
ユーザー LaFolia13LaFolia13
提出日時 2023-07-29 18:23:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,143 bytes
コンパイル時間 2,302 ms
コンパイル使用メモリ 200,420 KB
実行使用メモリ 101,636 KB
最終ジャッジ日時 2024-04-16 23:36:58
合計ジャッジ時間 9,269 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 AC 11 ms
5,376 KB
testcase_02 AC 30 ms
5,376 KB
testcase_03 AC 6 ms
5,376 KB
testcase_04 AC 11 ms
5,376 KB
testcase_05 AC 22 ms
5,376 KB
testcase_06 AC 21 ms
5,376 KB
testcase_07 AC 21 ms
5,376 KB
testcase_08 AC 27 ms
5,376 KB
testcase_09 AC 39 ms
5,376 KB
testcase_10 AC 18 ms
5,376 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_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: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;
      |          ^

ソースコード

diff #

#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;
}
0