結果
| 問題 |
No.1946 ロッカーの問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-20 20:41:29 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,725 bytes |
| コンパイル時間 | 15,324 ms |
| コンパイル使用メモリ | 166,340 KB |
| 実行使用メモリ | 61,440 KB |
| 最終ジャッジ日時 | 2024-10-13 08:57:17 |
| 合計ジャッジ時間 | 20,516 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 16 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (132 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
//using static CompLib.CompLib;
//using DataStructure;
namespace atcoder
{
class Program
{
const int intMax = 1000000000;
const long longMax = 2000000000000000000;
static void Main(string[] args)
{
var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
var A = new int[NM[1]];
if (NM[1] != 0)
A = Console.ReadLine().Split().Select(int.Parse).ToArray();
var cnt = new int[NM[0] + 1];
var open = new bool[NM[0] + 1];
for (int i = 0; i < NM[1]; i++)
{
open[A[i]] = true;
}
cnt[1] = 1;
for (int i = 2; i <= NM[0]; i++)
{
int idx = 1;
while (i / idx >= 1)
{
if (idx == i) break;
if (i % idx == 0)
cnt[i / idx]++;
idx++;
}
}
int ans = 0;
for (int i = NM[0]; i >= 0; i--)
{
if ((open[i] && cnt[i] % 2 == 0) || (!open[i] && cnt[i] % 2 == 1))
{
ans++;
int idx = 1;
while (idx != i && i / idx > 0)
{
if (i % idx == 0)
{
cnt[i / idx]--;
}
idx++;
}
}
}
Console.WriteLine(ans);
}
}
}