結果

問題 No.1619 Coccinellidae
ユーザー kotatsugamekotatsugame
提出日時 2021-08-09 23:30:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 64,632 KB
実行使用メモリ 4,400 KB
最終ジャッジ日時 2023-10-21 21:08:44
合計ジャッジ時間 3,459 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 103 ms
4,348 KB
testcase_02 AC 136 ms
4,400 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 133 ms
4,400 KB
testcase_05 AC 79 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 80 ms
4,348 KB
testcase_08 AC 75 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 67 ms
4,348 KB
testcase_11 AC 93 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 126 ms
4,368 KB
testcase_14 AC 136 ms
4,400 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#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