結果
問題 | No.190 Dry Wet Moist |
ユーザー |
![]() |
提出日時 | 2015-06-16 23:45:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,831 bytes |
コンパイル時間 | 902 ms |
コンパイル使用メモリ | 114,860 KB |
実行使用メモリ | 41,016 KB |
最終ジャッジ日時 | 2024-07-07 03:25:09 |
合計ジャッジ時間 | 5,988 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | WA * 10 TLE * 1 -- * 17 |
コンパイルメッセージ
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; using System.Text; using System.Threading.Tasks; namespace foryuki { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); var A = ConvertStringArrayToIntArray(Console.ReadLine().Split()); var d = A.Where(x => x < 0).OrderBy(x => x).ToArray(); var cm1 = A.Where(x => x >= 0).OrderByDescending(x => x).ToArray(); int cnt = 0; bool isMatch; for (int i = 0; i < d.Length; i++) { isMatch = false; for (int j = 0; j < cm1.Length; j++) { if (d[i] + cm1[j] < 0) { isMatch = true; cnt++; break; } } if (!isMatch) { cnt += (d.Length - i) / 2; break; } } int dry = cnt; //---------------------------- var w = A.Where(x => x > 0).OrderByDescending(x => x).ToArray(); var cm2 = A.Where(x => x <= 0).OrderBy(x => x).ToArray(); cnt = 0; for (int i = 0; i < w.Length; i++) { isMatch = false; for (int j = 0; j < cm2.Length; j++) { if (w[i] + cm2[j] > 0) { isMatch = true; cnt++; break; } } if (!isMatch) { cnt += (w.Length - i) / 2; break; } } int wet = cnt; //------------------------------ cnt = 0; for (int i = 0; i < d.Length; i++) { for (int j = 0; j < w.Length; j++) { if (d[i] + w[j] == 0) { cnt++; } } } var moi = A.Where(x => x == 0).Count() + cnt; Console.WriteLine("{0} {1} {2}",dry,wet,moi); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] array) { return Array.ConvertAll(array, str => int.Parse(str)); } static List<int> ConvertStringArrayToIntList(string[] str) { var list = new List<int>(); foreach (var c in str) { list.Add(int.Parse(c)); } return list; } } }