結果
問題 | No.478 一般門松列列 |
ユーザー |
![]() |
提出日時 | 2017-01-27 23:01:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 1,115 bytes |
コンパイル時間 | 821 ms |
コンパイル使用メモリ | 67,656 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 16:45:58 |
合計ジャッジ時間 | 2,516 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream>#include <utility>#include <cstdio>#include <queue>#include <stack>#include <algorithm>#include <numeric>#include <vector>#include <set>#include <map>#include <string>#include <cstring>using namespace std;#define ALL(a) (a).begin(), (a).end()using ll = long long;using P = pair<int, int>;struct State {int v, cost;State(int v, int cost): v(v), cost(cost) {}// 昇順bool operator<(const State& s) const {return cost < s.cost;}// 降順bool operator>(const State& s) const {return cost > s.cost;}};void dump_vector(vector<int> vec) {for (int i = 0; i < vec.size(); i++) {cout << vec[i] << (i < vec.size() - 1 ? " " : "\n");}}int main() {int n, k;cin >> n >> k;int cur = 0,id = 0;for (int i = 0; i < n; i++) {cout << cur << endl;if (k > 0) {k--;} else {if (id % 2 == 0) {cur += 2;} else {cur -= 1;}id++;}}return 0;}