提出 #28391932
ソースコード 拡げる
#ifndef LOCAL
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#else
#include "Debug.hpp"
#endif
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using OrderedSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
class Task {
public:
void Perform() {
Read();
Solve();
}
private:
int n, k;
vector<int> p;
void Read() {
cin >> n >> k;
p.resize(n);
for (auto &i : p) {
cin >> i;
}
}
void Solve() {
OrderedSet<int> ordered_set;
for (int i = 0; i < k - 1; ++i) {
ordered_set.insert(p[i]);
}
for (int i = k - 1; i < n; ++i) {
ordered_set.insert(p[i]);
cout << *ordered_set.find_by_order(int(ordered_set.size()) - k) << '\n';
}
}
};
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
Task t;
t.Perform();
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Prefix K-th Max |
| ユーザ | tauhrick |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 400 |
| コード長 | 1008 Byte |
| 結果 | AC |
| 実行時間 | 393 ms |
| メモリ | 29352 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, example0.txt, example1.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 000.txt | AC | 2 ms | 3520 KiB |
| 001.txt | AC | 372 ms | 29304 KiB |
| 002.txt | AC | 336 ms | 28524 KiB |
| 003.txt | AC | 372 ms | 28552 KiB |
| 004.txt | AC | 342 ms | 28444 KiB |
| 005.txt | AC | 322 ms | 27144 KiB |
| 006.txt | AC | 145 ms | 16140 KiB |
| 007.txt | AC | 337 ms | 28224 KiB |
| 008.txt | AC | 111 ms | 13832 KiB |
| 009.txt | AC | 122 ms | 13876 KiB |
| 010.txt | AC | 372 ms | 29300 KiB |
| 011.txt | AC | 346 ms | 29312 KiB |
| 012.txt | AC | 271 ms | 28400 KiB |
| 013.txt | AC | 273 ms | 28552 KiB |
| 014.txt | AC | 317 ms | 28436 KiB |
| 015.txt | AC | 310 ms | 28552 KiB |
| 016.txt | AC | 319 ms | 28460 KiB |
| 017.txt | AC | 309 ms | 28400 KiB |
| 018.txt | AC | 336 ms | 29352 KiB |
| 019.txt | AC | 393 ms | 29296 KiB |
| 020.txt | AC | 249 ms | 28336 KiB |
| 021.txt | AC | 280 ms | 28340 KiB |
| 022.txt | AC | 302 ms | 28560 KiB |
| 023.txt | AC | 332 ms | 28612 KiB |
| 024.txt | AC | 295 ms | 28576 KiB |
| 025.txt | AC | 332 ms | 28516 KiB |
| example0.txt | AC | 7 ms | 3608 KiB |
| example1.txt | AC | 2 ms | 3564 KiB |