結果

問題 No.1619 Coccinellidae
コンテスト
ユーザー kotatsugame
提出日時 2021-08-09 23:30:39
言語 C++14
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 65 ms / 2,000 ms
+ 832µs
コード長 343 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 275 ms
コンパイル使用メモリ 74,276 KB
実行使用メモリ 9,732 KB
最終ジャッジ日時 2026-09-01 23:50:54
合計ジャッジ時間 2,625 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #
raw source code

#include<iostream>
using namespace std;
int N;
long M,K;
int ans[1<<17],tmp[1<<17];
main()
{
	cin>>N>>M>>K;
	M-=(long)N*(N-1)/2;
	for(int i=0;i<N;i++)tmp[i]=i;
	int l=0,r=N;
	for(int i=0;i<N;i++)
	{
		if(r-l-1<=K)
		{
			K-=r-l-1;
			ans[i]=tmp[--r];
		}
		else ans[i]=tmp[l++];
	}
	for(int i=0;i<N;i++)cout<<ans[i]+(ans[i]==N-1?M:0)<<endl;
}
0