結果
問題 | No.2421 entersys? |
ユーザー |
![]() |
提出日時 | 2023-08-12 15:20:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,877 bytes |
コンパイル時間 | 2,267 ms |
コンパイル使用メモリ | 188,172 KB |
実行使用メモリ | 37,708 KB |
最終ジャッジ日時 | 2024-11-20 01:26:42 |
合計ジャッジ時間 | 68,878 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 TLE * 16 |
ソースコード
#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, set<pair<int,int>>> mp;V<int> stin, stout;rep(i,0,n) {string name;int inT, outT;cin >> name >> inT >> outT;mp[name].insert({inT, -1});mp[name].insert({outT, 1});stin.push_back(inT);stout.push_back(outT);}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].insert({tin,-1});mp[name].insert({tout,1});stin.push_back(tin);sort(all(stin));stout.push_back(tout);sort(all(stout));}}return 0;}