結果
問題 | No.2809 Sort Query |
ユーザー | chineristAC |
提出日時 | 2024-07-12 21:15:42 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,650 bytes |
コンパイル時間 | 3,353 ms |
コンパイル使用メモリ | 191,680 KB |
実行使用メモリ | 58,496 KB |
最終ジャッジ日時 | 2024-07-12 21:17:10 |
合計ジャッジ時間 | 44,586 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | AC | 916 ms
58,368 KB |
testcase_42 | AC | 912 ms
58,368 KB |
testcase_43 | AC | 933 ms
58,368 KB |
testcase_44 | AC | 902 ms
58,368 KB |
testcase_45 | AC | 885 ms
58,496 KB |
testcase_46 | AC | 821 ms
58,348 KB |
testcase_47 | AC | 827 ms
58,496 KB |
testcase_48 | AC | 869 ms
58,240 KB |
testcase_49 | AC | 823 ms
58,368 KB |
testcase_50 | AC | 904 ms
58,488 KB |
testcase_51 | AC | 770 ms
39,552 KB |
testcase_52 | AC | 662 ms
39,552 KB |
testcase_53 | AC | 669 ms
39,552 KB |
testcase_54 | AC | 524 ms
39,552 KB |
testcase_55 | AC | 579 ms
39,424 KB |
testcase_56 | RE | - |
testcase_57 | RE | - |
testcase_58 | RE | - |
testcase_59 | RE | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | RE | - |
testcase_63 | RE | - |
testcase_64 | RE | - |
testcase_65 | RE | - |
testcase_66 | RE | - |
testcase_67 | RE | - |
testcase_68 | WA | - |
testcase_69 | RE | - |
testcase_70 | AC | 2 ms
6,948 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <map> #include <set> #include <queue> #include <algorithm> #include <cmath> #include <iomanip> #include <random> #include <stdio.h> #include <fstream> #include <functional> #include <cassert> #include <unordered_map> #include <bitset> #include <chrono> #include <atcoder/modint> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace atcoder; using namespace __gnu_pbds; using mint = modint1000000007; #define rep(i,n) for (int i=0;i<n;i+=1) #define rrep(i,n) for (int i=n-1;i>-1;i--) #define pb push_back #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << " )\n"; template<class T> using vec = vector<T>; template<class T> using vvec = vec<vec<T>>; template<class T> using vvvec = vec<vvec<T>>; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<class T> bool chmin(T &a, T b){ if (a>b){ a = b; return true; } return false; } template<class T> bool chmax(T &a, T b){ if (a<b){ a = b; return true; } return false; } template<class T> T sum(vec<T> x){ T res=0; for (auto e:x){ res += e; } return res; } template<class T> void printv(vec<T> x){ for (auto e:x){ cout<<e<<" "; } cout<<endl; } template<class T,class U> ostream& operator<<(ostream& os, const pair<T,U>& A){ os << "(" << A.first <<", " << A.second << ")"; return os; } template<class T> ostream& operator<<(ostream& os, const set<T>& S){ os << "set{"; for (auto a:S){ os << a; auto it = S.find(a); it++; if (it!=S.end()){ os << ", "; } } os << "}"; return os; } template<class T> ostream& operator<<(ostream& os, const tuple<T,T,T>& a){ auto [x,y,z] = a; os << "(" << x << ", " << y << ", " << z << ")"; return os; } template<class T> ostream& operator<<(ostream& os, const map<ll,T>& A){ os << "map{"; for (auto e:A){ os << e.first; os << ":"; os << e.second; os << ", "; } os << "}"; return os; } template<class T> ostream& operator<<(ostream& os, const vec<T>& A){ os << "["; rep(i,A.size()){ os << A[i]; if (i!=A.size()-1){ os << ", "; } } os << "]" ; return os; } ostream& operator<<(ostream& os, const mint& a){ os << a.val(); return os; } void solve(){ int N,Q; cin>>N>>Q; vec<ll> A(N); rep(i,N) cin>>A[i]; vec<int> sorted_idx(N,0); tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> sorted_val_set; set<int> update_idx = {}; rep(i,N){ update_idx.insert(i); } map<int,ll> update_val; rep(i,N){ update_val[i] = A[i]; } while (Q--){ int t; cin>>t; if (t == 1){ int k,x; cin>>k>>x; k--; if (!update_idx.count(k)){ sorted_idx[k] = 0; update_idx.insert(k); } update_val[k] = x; } else if (t == 2){ for (auto i:update_idx){ sorted_val_set.erase({A[i],i}); sorted_val_set.insert({update_val[i],i}); sorted_idx[i] = 1; } update_idx.clear(); update_val.clear(); } else{ int k; cin>>k; k--; if (sorted_idx[k]){ auto [val,x] = *sorted_val_set.find_by_order(k); cout << val << "\n"; } else{ cout << update_val[k] << "\n"; } } } } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); int T = 1; while (T--){ solve(); } }