結果

問題 No.2421 entersys?
ユーザー keisuke6keisuke6
提出日時 2023-08-12 14:46:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,091 bytes
コンパイル時間 2,932 ms
コンパイル使用メモリ 249,028 KB
実行使用メモリ 50,048 KB
最終ジャッジ日時 2024-04-30 07:11:33
合計ジャッジ時間 20,150 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 5 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 4 ms
5,376 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 AC 826 ms
29,952 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 622 ms
22,272 KB
testcase_27 AC 613 ms
22,272 KB
testcase_28 AC 629 ms
22,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = 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_set<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;
  	}
  }
}
0