結果

問題 No.616 へんなソート
ユーザー tailstails
提出日時 2017-12-16 01:29:28
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 396 bytes
コンパイル時間 1,545 ms
コンパイル使用メモリ 157,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-05-08 12:46:32
合計ジャッジ時間 10,883 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 29 ms
5,376 KB
testcase_13 TLE -
testcase_14 AC 9 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 1,820 ms
5,376 KB
testcase_18 AC 577 ms
5,376 KB
testcase_19 AC 392 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 7 ms
5,376 KB
testcase_22 AC 132 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 108 ms
5,376 KB
testcase_27 AC 81 ms
5,376 KB
testcase_28 TLE -
testcase_29 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:13:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%d%d",&n,&k);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define M 1000000007

typedef long long ll;

int n,k,m,i,j,l,r;

int b[60000*2];
int*v=b,*w=b+60000;

main(){
	scanf("%d%d",&n,&k);
	v[0]=1;
	m=0;
	for(i=n;--i;){
		m+=i;
		for(j=0;j<=m;++j){
			w[j]=v[j];
			for(l=1;l<=i&&l<=j;++l){
				w[j]=(w[j]+v[j-l])%M;
			}
		}
		swap(v,w);
	}
	int r=0;
	for(;k>=0;--k){
		r=(r+v[k])%M;
	}
	printf("%d",r);
}
0