結果
| 問題 | No.707 書道 |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-10-15 23:20:46 |
| 言語 | C# (.NET 10.0.402 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 45 ms / 2,000 ms |
| + 8µs | |
| コード長 | 1,514 bytes |
| 記録 | |
| コンパイル時間 | 12,084 ms |
| コンパイル使用メモリ | 172,724 KB |
| 実行使用メモリ | 33,484 KB |
| 最終ジャッジ日時 | 2026-10-15 23:21:51 |
| 合計ジャッジ時間 | 7,163 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (277 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
static int NN => int.Parse(ReadLine());
static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
public static void Main()
{
Solve();
}
static void Solve()
{
var c = NList;
var (h, w) = (c[0], c[1]);
var p = SList(h);
var ans = double.MaxValue;
for (var si = 0; si < h; ++si)
{
var left = 0.0;
var right = 0.0;
for (var i = 0; i < h; ++i) for (var j = 0; j < w; ++j) if (p[i][j] == '1')
{
left += Length(i, j, si, -1);
right += Length(i, j, si, w);
}
ans = Math.Min(ans, Math.Min(left, right));
}
for (var sj = 0; sj < w; ++sj)
{
var top = 0.0;
var btm = 0.0;
for (var i = 0; i < h; ++i) for (var j = 0; j < w; ++j) if (p[i][j] == '1')
{
top += Length(i, j, -1, sj);
btm += Length(i, j, h, sj);
}
ans = Math.Min(ans, Math.Min(top, btm));
}
WriteLine(ans);
}
static double Length(int x1, int y1, int x2, int y2)
{
return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
}