結果
問題 | No.1619 Coccinellidae |
ユーザー | 👑 Nachia |
提出日時 | 2021-07-22 21:57:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 739 bytes |
コンパイル時間 | 898 ms |
コンパイル使用メモリ | 79,604 KB |
最終ジャッジ日時 | 2025-01-23 06:37:34 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
ソースコード
#include <iostream> #include <deque> #include <algorithm> using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) int main(){ ll N,M,K; cin >> N >> M >> K; deque<ll> A(N); rep(i,N) A[i] = i; A[N-1] += M - (N*(N-1)/2); deque<ll> ans; while(K != 0){ if(ans.size() <= K){ K -= ans.size(); ans.push_front(A.front()); A.pop_front(); } else{ ans.push_back(A.front()); A.pop_front(); int p = ans.size()-1; while(K != 0){ K--; swap(ans[p-1],ans[p]); p--; } } } while(A.size()){ ans.push_back(A.front()); A.pop_front(); } rep(i,N) cout << ans[i] << "\n"; return 0; }