結果

問題 No.1619 Coccinellidae
ユーザー SSRS
提出日時 2021-07-22 21:47:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 175,524 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-17 17:13:15
合計ジャッジ時間 4,306 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  long long M, K;
  cin >> N >> M >> K;
  deque<int> dq;
  dq.push_back(0);
  for (int i = 1; i < N; i++){
    if (K >= i){
      dq.push_front(i);
      K -= i;
    } else if (K == 0){
      dq.push_back(i);
    } else {
      dq.insert(dq.end() - K, i);
      K = 0;
    }
  }
  for (int i = 0; i < N; i++){
    if (dq[i] < N - 1){
      cout << dq[i] << endl;
    } else {
      cout << M - (long long) (N - 1) * (N - 2) / 2 << endl;
    }
  }
}
0