結果
問題 |
No.2421 entersys?
|
ユーザー |
![]() |
提出日時 | 2023-08-12 14:48:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,101 bytes |
コンパイル時間 | 3,196 ms |
コンパイル使用メモリ | 238,468 KB |
最終ジャッジ日時 | 2025-02-16 05:20:12 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 WA * 14 |
ソースコード
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<typename T> using ordered_multiset = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>; using namespace std; #define int long long signed main(){ int N,Q; cin>>N; map<string,set<pair<int,int>>> m; ordered_multiset<int> s,t; for(int i=0;i<N;i++){ string ss; int a,b; cin>>ss>>a>>b; b++; m[ss].insert({a,b}); s.insert(a); t.insert(b); } cin>>Q; while(Q--){ int tt; cin>>tt; //cout<<tt<<endl; if(tt == 3){ string ss; int a,b; cin>>ss>>a>>b; b++; m[ss].insert({a,b}); s.insert(a); t.insert(b); } else if(tt == 1){ string ss; int k; cin>>ss>>k; auto it = m[ss].lower_bound({k+1,-1}); if(m[ss].begin() == it) cout<<"No"<<endl; else{ it--; int a,b; tie(a,b) = *it; if(a <= k && k < b) cout<<"Yes"<<endl; else cout<<"No"<<endl; } } else{ int k; cin>>k; k++; cout<<s.order_of_key(k)-t.order_of_key(k)<<endl; } } }