結果
問題 |
No.478 一般門松列列
|
ユーザー |
![]() |
提出日時 | 2017-01-27 22:45:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 579 bytes |
コンパイル時間 | 1,584 ms |
コンパイル使用メモリ | 166,612 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 16:30:37 |
合計ジャッジ時間 | 5,716 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 RE * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int x[4] = { 4, 2, 3, 1 }; int a[100000]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; for(int i = 0; i < n; i++) { a[i] = x[i % 4]; } for(int i = 0; i < k; i++) { a[i] = 0; } int cnt = 0; for(int i = 0; i < n - 2; i++) { if(a[i] < a[i + 1] && a[i + 1] > a[i + 2]) cnt++; if(a[i] > a[i + 1] && a[i + 1] < a[i + 2]) cnt++; } assert(cnt == n - k - 2); for(int i = 0; i < n; i++) { cout << a[i]; if(i == n - 1) cout << endl; else cout << " "; } }