結果

問題 No.2421 entersys?
ユーザー xueleixuelei
提出日時 2023-08-12 15:13:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,949 bytes
コンパイル時間 2,405 ms
コンパイル使用メモリ 191,080 KB
実行使用メモリ 15,900 KB
最終ジャッジ日時 2024-04-30 08:26:19
合計ジャッジ時間 7,834 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 14 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 4 ms
6,940 KB
testcase_05 AC 9 ms
6,944 KB
testcase_06 AC 8 ms
6,944 KB
testcase_07 AC 9 ms
6,940 KB
testcase_08 AC 12 ms
6,944 KB
testcase_09 AC 29 ms
6,944 KB
testcase_10 AC 6 ms
6,944 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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++)
#define rrep(i, a, b) for (int i = (int)(b) - 1; (i) >= (int)(a); (i)--)
#define all(v) v.begin(), v.end()

typedef long long ll;
template <class T> using V = vector<T>;
template <class T> using VV = vector<V<T>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    constexpr char endl = '\n';

    int n,q;
    cin >> n;
    
    map<string, V<pair<int,int>>> mp; 
    V<int> stin, stout;
    rep(i,0,n) {
        string name;
        int inT, outT;
        cin >> name >> inT >> outT;
        mp[name].push_back({inT, -1});
        mp[name].push_back({outT, 1});
        stin.push_back(inT);
        stout.push_back(outT);
        sort(all(mp[name]));
    }
    sort(all(stin));
    sort(all(stout));

    cin >> q;
    rep(i,0,q) {
        int cmd;
        cin >> cmd;
        if (cmd == 1) {
            string name;
            int t;
            cin >> name >> t;
            if (mp.find(name) == mp.end()) {
                cout << "No" << endl;
                continue;
            }
            auto mpst = mp[name];
            auto pos = lower_bound(all(mpst), make_pair(t,0));
            if ((*pos).second == 1) cout << "Yes" << endl;
            else cout << "No" << endl;
        } else if (cmd == 2) {
            int t;
            cin >> t;
            int in = lower_bound(all(stin), t+1) - stin.begin();
            int out = lower_bound(all(stout), t) - stout.begin();
            cout << in - out << endl;
        } else {
            string name;
            int tin, tout;
            cin >> name >> tin >> tout;
            mp[name].push_back({tin,-1});
            mp[name].push_back({tout,1});
            sort(all(mp[name]));
            stin.push_back(tin);
            sort(all(stin));
            stout.push_back(tout);
            sort(all(stout));
        }
    }
    return 0;
}
0