結果
| 問題 |
No.478 一般門松列列
|
| コンテスト | |
| ユーザー |
walkre
|
| 提出日時 | 2017-01-28 00:45:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,222 bytes |
| コンパイル時間 | 1,853 ms |
| コンパイル使用メモリ | 168,908 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 18:27:09 |
| 合計ジャッジ時間 | 6,653 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
os << "[";
for (const auto &v : vec) {
os << v << ",";
}
os << "]";
return os;
}
void solve(){
int n,k,l;
cin >> n >> k;
l=n-k-2;
vector<int> a(n),b(n);
rep(i,1,n-1){
if(l==0) continue;
--l;
if(b[i-1]==1){
a[i]=min(a[i-1],0)-1;
b[i]=-1;
}
if(b[i-1]==-1){
a[i]=max(a[i-1],0)+1;
b[i]=1;
}
if(b[i-1]==0){
a[i]=1;
b[i]=1;
}
}
if(l!=0) cout << -1 << endl;
else{
cout << a[0];
rep(i,1,n) cout << " " << a[i];
cout << endl;
}
}
int main(){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(10);
solve();
return 0;
}
walkre