結果
| 問題 | No.966 引き算をして門松列(その1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-13 23:33:12 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,625 bytes |
| 記録 | |
| コンパイル時間 | 8,685 ms |
| コンパイル使用メモリ | 172,220 KB |
| 実行使用メモリ | 192,700 KB |
| 最終ジャッジ日時 | 2025-12-13 23:33:23 |
| 合計ジャッジ時間 | 9,208 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 3 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (88 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.Intrinsics.Arm;
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 t = NN;
var ans = new int[t];
for (var i = 0; i < t; ++i)
{
var c = NList;
ans[i] = Kado(c[0], c[1], c[2]);
}
WriteLine(string.Join("\n", ans));
}
static int Kado(int a, int b, int c)
{
if (a > b && b < c)
{
if (a != c) return 0;
if (a == 1) return -1;
return 1;
}
if (a < b && b > c)
{
if (a != c) return 0;
if (a == 1) return -1;
return 1;
}
if (a > c) (a, c) = (c, a);
// ここから a <= b, b <= c
if (a == c)
{
if (a < 3) return -1;
return 3;
}
if (a == b)
{
if (a < 2) return -1;
return 1;
}
if (b == c)
{
if (b < 2) return -1;
return 1;
}
// ここから a < b < c
if (b == 2) return -1;
if (a == 1)
{
return c - b + 1;
}
return Math.Min(c - b, b - a) + 1;
}
}