結果

問題 No.2560 A_1 < A_2 < ... < A_N
コンテスト
ユーザー tatt61880
提出日時 2026-05-02 16:56:31
言語 Kuin
(KuinC++ v.2021.9.17)
コンパイル:
kuinc -i _filename_ -o out.cpp -s /kuin/sys/ -e cpp -r -q
実行:
./a.out
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 357 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,151 ms
コンパイル使用メモリ 167,740 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2026-05-02 16:56:42
合計ジャッジ時間 8,287 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<Array_<char16_t>>' [-Wnontrivial-memcall]
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
out.cpp:688:9: note: in instantiation of function template specialization 'newArraysRec_<std::shared_ptr<Array_<std::shared_ptr<Array_<char16_t>>>>>::operator()<long>' requested here
  688 |         return newArraysRec_<T>()(std::forward<A>(a)...);
      |                ^
out.cpp:1819:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<Array_<char16_t>>>>, long>' requested here
 1819 | (k_eq) = (newArrays_<type_(Array_<type_(Array_<char16_t>)>)>(((k_eo)->Len())));
      |           ^
out.cpp:676:14: note: explicitly cast the pointer to silence this warning
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
      |                                (void*)
1 warning generated.

ソースコード

diff #
raw source code

func main()
	var t: int :: cui@inputInt()
	for(1, t)
		var n: int :: cui@inputInt()
		var x: int :: cui@inputInt()
		var a: []int :: #[n]int
		for i(0, n - 1)
			do a[i] :: i + 1
		end for
		var sum: int :: n * (n + 1) / 2
		if(sum <= x)
			do a[n - 1] :+ x - sum
			do cui@print("\{a.join(" ")}\n")
		else
			do cui@print("-1\n")
		end if
	end for
end func
0