結果

問題 No.1890 Many Sequences Sum Queries
ユーザー tailstails
提出日時 2022-04-04 15:15:03
言語 cLay
(20240104-1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 218 bytes
コンパイル時間 1,942 ms
コンパイル使用メモリ 173,852 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-04 05:05:19
合計ジャッジ時間 8,027 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 31 ms
6,820 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 80 ms
6,944 KB
testcase_08 AC 9 ms
6,940 KB
testcase_09 AC 11 ms
6,940 KB
testcase_10 AC 71 ms
6,944 KB
testcase_11 AC 42 ms
6,940 KB
testcase_12 AC 163 ms
6,940 KB
testcase_13 AC 130 ms
6,940 KB
testcase_14 AC 93 ms
6,944 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,948 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n,@q,@a[n],@s[q];
rep(j,q){
	ll sj=s[j];
	ll z=0,i=0;
	while(i<n&&sj-a[i]*(a[i]+1)/2>0){
		z+=a[i];
		sj-=a[i]*(a[i]+1)/2;
		++i;
	}
	if(i==n){
		wt(-1);
	}else{
		ll k=0;
		while(sj-=++k,sj>0){
		}
		wt(z+k);
	}
}
0