結果
問題 | No.2421 entersys? |
ユーザー | arad |
提出日時 | 2023-08-12 15:25:25 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 4,269 bytes |
コンパイル時間 | 4,638 ms |
コンパイル使用メモリ | 286,680 KB |
実行使用メモリ | 39,708 KB |
最終ジャッジ日時 | 2024-11-20 02:07:03 |
合計ジャッジ時間 | 78,456 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
13,768 KB |
testcase_01 | AC | 5 ms
13,640 KB |
testcase_02 | AC | 14 ms
13,636 KB |
testcase_03 | AC | 3 ms
30,572 KB |
testcase_04 | AC | 5 ms
13,636 KB |
testcase_05 | AC | 8 ms
29,968 KB |
testcase_06 | AC | 9 ms
13,640 KB |
testcase_07 | AC | 8 ms
30,556 KB |
testcase_08 | AC | 13 ms
13,632 KB |
testcase_09 | AC | 21 ms
29,272 KB |
testcase_10 | AC | 7 ms
13,636 KB |
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,-1),r(n,-1),t(n,-1),type(n,-1),ans(100100,-1); VS x(n); 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; ll typei,ti,li,ri; string xi; cin >> typei; type.emplace_back(typei); if(type[i+n] == 1){ cin >> xi >> ti; x.emplace_back(xi); t.emplace_back(ti); l.emplace_back(-1); r.emplace_back(-1); events.emplace_back(t[i+n],i+n+inf); } if(type[i+n] == 2){ cin >> ti; x.emplace_back(""); t.emplace_back(ti); l.emplace_back(-1); r.emplace_back(-1); events.emplace_back(t[i+n],i+n+inf); } if(type[i+n] == 3){ cin >> xi >> li >> ri; x.emplace_back(xi); t.emplace_back(-1); l.emplace_back(li); r.emplace_back(ri); } } sort(all(events)); set<string> st; ll cnt = 0; for(auto e:events){ auto [time,i] = e; 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-n] = 1; } else { ans[i-n] = 0; } } else { ans[i-n] = cnt; } } else { //out i -= 2*inf; st.erase(x[i]); cnt--; } } VP nevents; rep(i,sz(events)){ if(inf <= events[i].second && events[i].second < 2*inf){ continue; } nevents.emplace_back(events[i]); } events = nevents; for(int i = sqq*bl;i < sqq*(bl+1);i++){ if(i >= q) break; 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 && x[i+n] == x[j+n]){ ans[i] = 1; } else if(type[i+n] == 2){ ans[i]++; } } } } for(int i = sqq*bl;i < sqq*(bl+1);i++){ if(i >= q) break; 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-n] == 1) out("Yes"); else out("No"); } if(type[i] == 2){ out(ans[i-n]); } } }