結果

問題 No.2421 entersys?
ユーザー maeshunmaeshun
提出日時 2023-08-12 17:11:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,190 bytes
コンパイル時間 3,804 ms
コンパイル使用メモリ 252,948 KB
実行使用メモリ 60,936 KB
最終ジャッジ日時 2024-04-30 12:14:31
合計ジャッジ時間 21,326 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 5 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 4 ms
6,940 KB
testcase_06 AC 4 ms
6,940 KB
testcase_07 AC 4 ms
6,944 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 4 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 801 ms
47,344 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 692 ms
36,988 KB
testcase_27 AC 638 ms
36,868 KB
testcase_28 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:73:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   73 |                 auto [a, b] = *it;
      |                      ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for(int i=0;i<(n);++i)
#define rep1(i, n) for(int i=1;i<=(n);i++)
#define ll long long
using mint = modint998244353;
using P = pair<ll,ll>;
using lb = long double;
using T = tuple<ll, ll, ll>;
#ifdef LOCAL
#  include <debug_print.hpp>
#  define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#  define dbg(...) (static_cast<void>(0))
#endif

int main()
{
    int n;
    cin >> n;
    map<int, int> mp;
    vector<string> x(n);
    vector<int> l(n), r(n);
    rep(i,n){
        cin >> x[i] >> l[i] >> r[i];
        mp[l[i]] = 0;
        mp[r[i]] = 0;
        mp[r[i]+1] = 0;
    }
    int q;
    cin >> q;
    vector<int> t(q), L(q), R(q), T(q);
    vector<string> X(q);
    rep(qi,q){
        cin >> t[qi];
        if(t[qi]==1){
            cin >> X[qi] >> T[qi];
            mp[T[qi]] = 0;
        }
        else if(t[qi]==2){
            cin >> T[qi];
            mp[T[qi]] = 0;
            mp[T[qi]+1] = 0;
        }
        else{
            cin >> X[qi] >> L[qi] >> R[qi];
            mp[L[qi]] = 0;
            mp[R[qi]] = 0;
            mp[R[qi]+1] = 0;
        }
    }
    int m = 0;
    for(auto & p : mp){
        p.second = m++;
    }
    fenwick_tree<int> bit(m);
    map<string, set<pair<int, int>>> xs;
    rep(i,n){
        bit.add(mp[l[i]], 1);
        bit.add(mp[r[i]+1], -1);
        xs[x[i]].emplace(l[i], r[i]);
    }
    rep(qi,q){
        if(t[qi]==1){
            auto it = xs[X[qi]].upper_bound({T[qi], 1e9});
            if(it==xs[X[qi]].end()){
                cout << "No" << endl;
            }
            else{
                it--;
                auto [a, b] = *it;
                if(a<=T[qi] && T[qi]<=b){
                    cout << "Yes" << endl;
                }
                else{
                    cout << "No" << endl;
                }
            }
        }
        else if(t[qi]==2){
            cout << bit.sum(0, mp[T[qi]+1]) << endl;
        }
        else{
            xs[X[qi]].emplace(L[qi], R[qi]);
            bit.add(mp[L[qi]],1);
            bit.add(mp[R[qi]+1],-1);
        }
    }
    return 0;
}
0