結果
| 問題 |
No.478 一般門松列列
|
| コンテスト | |
| ユーザー |
tk142525
|
| 提出日時 | 2018-05-19 17:20:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 643 bytes |
| コンパイル時間 | 558 ms |
| コンパイル使用メモリ | 72,632 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 14:25:34 |
| 合計ジャッジ時間 | 2,021 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
using namespace std;
int main() {
int n, k, tmp_max, tmp_min;
cin >> n >> k;
vector<int> ans;
ans.push_back(n / 2);
ans.push_back(n / 2 - 1);
for(int i = 1; i < n - 1; i++){
if(k > 0) {
ans.push_back(ans[i - 1]);
k--;
}else{
if(ans[i - 1] < ans[i])
ans.push_back(ans[i - 1] - 1);
else
ans.push_back(ans[i - 1] + 1);
}
}
for(auto a : ans){
cout << a << " ";
}
cout << endl;
return 0;
}
tk142525