Submission #82337
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <bits/extc++.h> using namespace std; template < class T> using Set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; int main() { cin.tie(nullptr); ios_base::sync_with_stdio( false ); int n; cin >> n; vector< int > a(n); Set<pair< int , int > > s; for ( int i = 0; i < n; ++i) { cin >> a[i]; s.insert({a[i], i}); } int q; cin >> q; for ( int i = 0; i < q; ++i) { int com, x, k; cin >> com; if (com == 1) { cin >> x >> k; --x; s.erase({a[x], x}); a[x] = k; s.insert({a[x], x}); } else { cin >> x; --x; cout << s.find_by_order(x)->first << '\n' ; } } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 1909 - Kth Smallest2 |
ユーザー名 | ei1903 |
投稿日時 | 2025-01-15 15:47:23 |
言語 | C++17 |
状態 | Accepted |
得点 | 14 |
ソースコード長 | 893 Byte |
最大実行時間 | 89 ms |
最大メモリ使用量 | 7648 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 14 / 14 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
input1.txt | AC | 30 ms | 604 KB |
1
|
input2.txt | AC | 27 ms | 808 KB |
1
|
input3.txt | AC | 22 ms | 892 KB |
1
|
input4.txt | AC | 16 ms | 972 KB |
1
|
input5.txt | AC | 15 ms | 1056 KB |
1
|
input6.txt | AC | 22 ms | 952 KB |
1
|
input7.txt | AC | 19 ms | 972 KB |
1
|
input8.txt | AC | 23 ms | 1528 KB |
1
|
input9.txt | AC | 89 ms | 7648 KB |
1
|
input10.txt | AC | 72 ms | 3112 KB |
1
|