結果
| 問題 | No.1673 Lamps on a line |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-17 16:42:18 |
| 言語 | C# (.NET 10.0.101) |
| 結果 |
AC
|
| 実行時間 | 441 ms / 2,000 ms |
| コード長 | 1,129 bytes |
| 記録 | |
| コンパイル時間 | 14,512 ms |
| コンパイル使用メモリ | 171,252 KB |
| 実行使用メモリ | 206,372 KB |
| 最終ジャッジ日時 | 2025-12-17 16:42:37 |
| 合計ジャッジ時間 | 12,990 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (136 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System.Numerics;
public class Program
{
public static void Main()
{
//BigInteger num = BigInteger.Parse(Console.ReadLine() ?? string.Empty);
//int num = int.Parse(Console.ReadLine() ?? string.Empty);
string[] moji = (Console.ReadLine() ?? string.Empty).Trim().Split(' ');
//string str = Console.ReadLine() ?? string.Empty;
int lamp = int.Parse(moji[0]);
int change = int.Parse(moji[1]);
int count = 0;
int[] light = new int[lamp];
for (int i = 1; i <= change; i++)
{
string[] str = (Console.ReadLine() ?? string.Empty).Trim().Split(' ');
int start = int.Parse(str[0]);
int finish = int.Parse(str[1]);
for (int j = start - 1; j < finish; j++)
{
if (light[j] == 1)
{
count--;
light[j] = 0;
}
else
{
count++;
light[j] = 1;
}
}
Console.WriteLine(count);
}
}
}