結果
| 問題 | No.1619 Coccinellidae | 
| コンテスト | |
| ユーザー |  Nachia | 
| 提出日時 | 2021-07-22 21:56:42 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 755 bytes | 
| コンパイル時間 | 831 ms | 
| コンパイル使用メモリ | 79,572 KB | 
| 最終ジャッジ日時 | 2025-01-23 06:37:20 | 
| ジャッジサーバーID (参考情報) | judge2 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | WA * 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";
  cout << "\n";
  return 0;
}
            
            
            
        