結果
問題 | No.2421 entersys? |
ユーザー | arad |
提出日時 | 2023-08-12 15:11:31 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,681 bytes |
コンパイル時間 | 5,277 ms |
コンパイル使用メモリ | 278,016 KB |
実行使用メモリ | 32,836 KB |
最終ジャッジ日時 | 2024-11-20 00:12:57 |
合計ジャッジ時間 | 78,877 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
15,616 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | TLE | - |
testcase_27 | TLE | - |
testcase_28 | TLE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<ll>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using VS = vector<string>; using P = pair<ll,ll>; using VP = vector<P>; #define rep(i, n) for (ll i = 0; i < ll(n); i++) #define out(x) cout << x << endl #define dout(x) cout << fixed << setprecision(10) << x << endl #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define sz(x) (int)(x.size()) #define re0 return 0 #define pcnt __builtin_popcountll template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } constexpr int inf = 1e9; constexpr ll INF = 1e18; //using mint = modint1000000007; using mint = modint998244353; int di[4] = {1,0,-1,0}; int dj[4] = {0,1,0,-1}; int main(){ ll n; cin >> n; VP events; VL l(n+100001,-1),r(n+100001,-1),t(n+100001,-1),type(n+100001,-1),ans(n+100001,-1); VS x(n+100001); rep(i,n){ cin >> x[i] >> l[i] >> r[i]; events.emplace_back(l[i],i); events.emplace_back(r[i],i+2*inf); } ll q; cin >> q; ll sqq = sqrt(q); for(ll bl = 0;bl <= sqq+1;bl++){ for(ll i = sqq*bl;i < sqq*(bl+1);i++){ if(i >= q) break; cin >> type[i+n]; if(type[i+n] == 1){ cin >> x[i+n] >> t[i+n]; events.emplace_back(t[i+n],i+n+inf); } if(type[i+n] == 2){ cin >> t[i+n]; events.emplace_back(t[i+n],i+n+inf); } if(type[i+n] == 3){ cin >> x[i+n] >> l[i+n] >> r[i+n]; } } sort(all(events)); set<string> st; ll cnt = 0; for(auto e:events){ auto [time,i] = e; if(time == INF) break; if(i < inf){ //in st.insert(x[i]); cnt++; } else if(i < 2*inf){ //check i -= inf; if(type[i] == 1){ if(st.count(x[i])){ ans[i] = 1; } else { ans[i] = 0; } } else { ans[i] = cnt; } } else { //out i -= 2*inf; st.erase(x[i]); cnt--; } } rep(i,sz(events)){ if(inf <= events[i].second && events[i].second < 2*inf){ events[i].first = INF; } } for(int i = sqq*bl;i < sqq*(bl+1);i++){ if(type[i+n] == 3) continue; for(int j = sqq*bl;j < i;j++){ if(type[j+n] != 3) continue; if(l[j+n] <= t[i+n] && t[i+n] <= r[j+n]){ if(type[i+n] == 1){ ans[i+n] = 1; } else if(type[i+n] == 2){ ans[i+n]++; } } } } for(int i = sqq*bl;i < sqq*(bl+1);i++){ if(type[i+n] == 3){ events.emplace_back(l[i+n],i+n); events.emplace_back(r[i+n],i+n+2*inf); } } } for(int i = n;i < n+q;i++){ if(type[i] == 1){ if(ans[i] == 1) out("Yes"); else out("No"); } if(type[i] == 2){ out(ans[i]); } } }