結果
問題 | No.349 干支の置き物 |
ユーザー |
|
提出日時 | 2017-10-29 11:14:48 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 814 bytes |
コンパイル時間 | 925 ms |
コンパイル使用メモリ | 104,064 KB |
実行使用メモリ | 18,304 KB |
最終ジャッジ日時 | 2024-11-22 05:06:02 |
合計ジャッジ時間 | 2,752 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Collections.Generic;using System.Linq;namespace yukicodeX {public class ProgramX {public static string Solver(System.IO.TextReader reader) {var n = int.Parse( reader.ReadLine() );var x = 0;var figures = new Dictionary<string, int>();for (var i = 0; i != n; ++i) {var buf = reader.ReadLine().Split();if (figures.ContainsKey( buf[ 0 ] )) figures[ buf[ 0 ] ] += 1;else figures.Add( buf[ 0 ], 1 );if (figures[ buf[ 0 ] ] > x) ++x;}return n % 2 == 0 ? x > n / 2 ? "NO" : "YES" : x > n / 2 + 1 ? "NO" : "YES";}private static void Main() {Console.WriteLine( Solver( Console.In ) );}}}