結果

問題 No.1619 Coccinellidae
ユーザー inksamuraiinksamurai
提出日時 2021-07-22 23:48:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,809 bytes
コンパイル時間 944 ms
コンパイル使用メモリ 107,596 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-24 20:26:52
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 8 ms
4,384 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 10 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 6 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 6 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 9 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <functional>
#include <numeric>
#include <iomanip> 
#include <stdio.h>
#include <assert.h>
#include <cstring>
//eolibraries
#define lnf 3999999999999999999
#define inf 999999999
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define all(c) (c).begin(),(c).end()
#define sz(c) (ll)(c).size()
#define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define pii pair <ll,ll>
#define tpii pair<pii,ll>
#define rep(i,n) for(ll i = 0 ; i < n ; i++) 
#define drep(i,n) for(ll i = n-1 ; i >= 0 ; i--)
#define crep(i,x,n) for(ll i = x ; i < n ; i++)
#define vi vector <ll> 
#define vec(...) vector<__VA_ARGS__>
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//eodefine
using namespace std;

const ll mxn=302;

int main(){
fcin;
	ll n;
	ll m,k;
	cin>>n>>m>>k;
	ll l=0,r=n,c=-1;
	while(l<=r){
		ll m=(l+r)/2;
		if((m*(m-1))/2<=k){
			l=m+1;
			c=m;
		}else{
			r=m-1;
		}
	}
	deque<ll> dq;
	ll now=n;
	while(now>n-c){
		dq.push_back(now);
		now--;
	}
	ll rem=k-(c*(c-1))/2;
	ll eh=0;
	drep(i,sz(dq)){
		if(rem==sz(dq)-i-1){
			eh=dq[i+1];
			crep(j,i+1,sz(dq)) dq[j]--;
			break;
		}
	}
	if(eh!=0) dq.push_front(eh);
	ll cmn=dq.back();
	ll x=1;
	while(x<cmn) {dq.push_front(x); x++;}
	ll sum=n*(n-1)/2;
	rem=m-sum;
	// cout<<sum<<"\n";
	rep(i,sz(dq)){
		if(dq[i]==n) {dq[i]+=rem;}
	}
	// set<ll> st;
	// for(auto x : dq) st.insert(x);
	// sum=0;
	// for(auto x : dq) sum+=x;
	for(auto x : dq) cout<<x-1<<"\n";
// 
	return 0;
}
0