提出 #28415699
ソースコード 拡げる
#include <string>
#include <iostream>
#include <stack>
#include <vector>
#include <set>
#include <cmath>
int main()
{
int n;
int k;
std::cin>>n>>k;
std::vector<int> buckets(n,0);
std::vector<int> nums;
for(int i = 1; i <= n; ++i){
int c;
std::cin>>c;
if (i <= k) {
buckets[c]++;
}
nums.push_back(c);
}
int ind = 0;
for(int i = 0; i < n; ++i){
if(buckets[i]>0){
ind = i;
break;
}
}
std::cout<<ind<<std::endl;
for(int i = k; i < n; ++i){
int cur = nums[i];
if(cur > ind){
buckets[cur]++;
buckets[ind]--;
if(buckets[ind] == 0){
for(int j = ind+1; j < n; ++j){
if(buckets[j]>0){
ind = j;
break;
}
}
}
}
std::cout<<ind<<std::endl;
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Prefix K-th Max |
| ユーザ | Eliphant |
| 言語 | C++ (Clang 10.0.0) |
| 得点 | 0 |
| コード長 | 1050 Byte |
| 結果 | WA |
| 実行時間 | 1094 ms |
| メモリ | 7992 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 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 | WA | 11 ms | 3044 KiB |
| 001.txt | WA | 1094 ms | 7888 KiB |
| 002.txt | AC | 280 ms | 6728 KiB |
| 003.txt | AC | 695 ms | 6912 KiB |
| 004.txt | AC | 822 ms | 6760 KiB |
| 005.txt | AC | 722 ms | 6624 KiB |
| 006.txt | AC | 559 ms | 4808 KiB |
| 007.txt | AC | 971 ms | 7364 KiB |
| 008.txt | AC | 284 ms | 4564 KiB |
| 009.txt | AC | 376 ms | 4548 KiB |
| 010.txt | WA | 1071 ms | 7872 KiB |
| 011.txt | WA | 1056 ms | 6748 KiB |
| 012.txt | AC | 244 ms | 6808 KiB |
| 013.txt | AC | 243 ms | 6724 KiB |
| 014.txt | AC | 664 ms | 6912 KiB |
| 015.txt | AC | 650 ms | 6824 KiB |
| 016.txt | AC | 650 ms | 6840 KiB |
| 017.txt | AC | 644 ms | 6844 KiB |
| 018.txt | WA | 1072 ms | 6724 KiB |
| 019.txt | WA | 1069 ms | 7992 KiB |
| 020.txt | AC | 253 ms | 6912 KiB |
| 021.txt | AC | 255 ms | 6772 KiB |
| 022.txt | AC | 662 ms | 6876 KiB |
| 023.txt | AC | 661 ms | 6680 KiB |
| 024.txt | AC | 659 ms | 6620 KiB |
| 025.txt | AC | 668 ms | 6764 KiB |
| example0.txt | AC | 5 ms | 3140 KiB |
| example1.txt | AC | 2 ms | 3016 KiB |