結果
| 問題 |
No.478 一般門松列列
|
| コンテスト | |
| ユーザー |
Yut176
|
| 提出日時 | 2017-01-27 22:51:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 696 bytes |
| コンパイル時間 | 768 ms |
| コンパイル使用メモリ | 85,076 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-23 16:38:51 |
| 合計ジャッジ時間 | 2,590 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;
int main(){
long long int n, k;
cin >> n >> k;
vector<int> ans(n);
int a = -1;
ans[0] = 0;
for(int i=1; i<n-k; i++){
ans[i] = ( ans[i-1] <= 0 ? ans[i-1] * -1 + 1 : ans[i-1] * -1 );
}
for(int i=n-k; i<n; i++){
ans[i] = ans[i-1];
}
int m = *min_element(ans.begin(), ans.end());
// cerr << m << endl;
// for(int i=0; i<n; i++) cerr << ans[i]-m+1 << " ";
// cerr << endl;
for(int i=0; i<n; i++){
cout << ans[i]-m+1 << endl;
}
return 0;
}
Yut176