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