結果
| 問題 | No.1692 Expectations |
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2021-10-02 07:03:21 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 126 ms / 2,000 ms |
| コード長 | 733 bytes |
| 記録 | |
| コンパイル時間 | 960 ms |
| コンパイル使用メモリ | 113,044 KB |
| 実行使用メモリ | 44,296 KB |
| 最終ジャッジ日時 | 2024-07-20 01:38:18 |
| 合計ジャッジ時間 | 3,637 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic;
using System.Linq;
using System;
public class Hello
{
static void Main()
{
string[] line = Console.ReadLine().Trim().Split(' ');
var n = int.Parse(line[0]);
var m = int.Parse(line[1]);
line = Console.ReadLine().Trim().Split(' ');
var a = Array.ConvertAll(line, int.Parse);
getAns(n, m, a);
}
static void getAns(int n, int m, int[] a)
{
int ansmax, ansmin;
var hs = new HashSet<int>();
for (int i = 0; i < n; i++) hs.Add(a[i]);
if (n == m && hs.Count() == 1) { ansmax = 1; ansmin = 1; }
else { ansmax = hs.Count(); ansmin = 0; }
Console.WriteLine("{0} {1}", ansmax, ansmin);
}
}
bluemegane