結果
問題 | No.1006 Share an Integer |
ユーザー |
|
提出日時 | 2020-03-06 21:38:57 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 161 ms / 2,000 ms |
コード長 | 498 bytes |
コンパイル時間 | 1,003 ms |
コンパイル使用メモリ | 115,664 KB |
実行使用メモリ | 11,216 KB |
最終ジャッジ日時 | 2024-06-22 05:38:56 |
合計ジャッジ時間 | 3,081 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto N = readln.chomp.to!int; auto A = iota(N+1).array; foreach (i; 1..N+1) foreach (j; iota(i, N+1, i)) { A[j] -= 1; } int mn = iota(1, N).map!(i => abs(A[i] - A[N-i])).reduce!min; foreach (i; 1..N) if (abs(A[i] - A[N-i]) == mn) writeln(i, " ", N-i); }