結果
問題 | No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい |
ユーザー | jousen |
提出日時 | 2016-10-14 23:56:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,716 bytes |
コンパイル時間 | 900 ms |
コンパイル使用メモリ | 111,872 KB |
実行使用メモリ | 50,028 KB |
最終ジャッジ日時 | 2024-11-22 07:39:28 |
合計ジャッジ時間 | 17,892 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 42 ms
27,532 KB |
testcase_31 | AC | 41 ms
25,652 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 40 ms
19,328 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 72 ms
24,832 KB |
testcase_44 | AC | 72 ms
24,960 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
コンパイルメッセージ
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.Collections; using System.Linq; namespace tes { class contest { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); int n = input[0]; int k = input[1]; var arr = new int[n][]; var passed = new Dictionary<int, int>(); var score = new Dictionary<int, int>(); var memo = new Dictionary<Tuple<int, int, int>, int>(); //memo the index of teams for (int i =0; i< n; i++) { arr[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); int ac = arr[i][0]; int penalty = arr[i][1]; int univarsity = arr[i][2]; memo[new Tuple<int, int, int>(ac, penalty, univarsity)] = i; } //Array.Sort(arr, (a, b) => b[0]-a[0]); arr = arr.OrderByDescending(a=>a[0]).ThenBy(c=>c[2]).ThenBy(b=>b[1]).ToArray(); //memo the temporary No //var tmpNo = new Dictionary<int, int>(); //for (int i = 0; i < n; i ++) //{ // int ac = arr[i][0]; // int penalty = arr[i][1]; // int univarsity = arr[i][2]; // memo[new Tuple<int, int, int>(ac, penalty, univarsity)] = i + 1; //} //count ans memo scores of all teams for (int i = 0; i < n; i++) { int ac = arr[i][0]; int penalty = arr[i][1]; int univarsity = arr[i][2]; if (!score.Keys.Contains(ac)) { score[ac] = 1; } else score[ac] = score[ac] + 1; } var ans = new List<int>(); for(int i =0; i<arr.Length-1; i++) { int ac = arr[i][0]; int penalty = arr[i][1]; int univarsity = arr[i][2]; if (arr[i][0] == arr[i+1][0]) { if(arr[i][2] == arr[i+1][2]) { ans.Add(memo[new Tuple<int, int, int>(ac, penalty, univarsity)]); if (!passed.Keys.Contains(arr[i][2])) { passed[arr[i][2]] = 1; } else { passed[arr[i][2]] += 1; } } else { if ((passed.Keys.Contains(arr[i][2]) && passed.Keys.Contains(arr[i+1][2]))&& passed[arr[i][2]] < passed[arr[i+1][2]]) { ans.Add(memo[new Tuple<int, int, int>(ac, penalty, univarsity)]); if (!passed.Keys.Contains(arr[i][2])) { passed[arr[i][2]] = 1; } else { passed[arr[i][2]] += 1; } } else { ac = arr[i+1][0]; penalty = arr[i+1][1]; univarsity = arr[i+1][2]; ans.Add(memo[new Tuple<int, int, int>(ac, penalty, univarsity)]); if (!passed.Keys.Contains(arr[i+1][2])) { passed[arr[i+1][2]] = 1; } else { passed[arr[i+1][2]] += 1; } } } } else { ans.Add(memo[new Tuple<int, int, int>(ac, penalty, univarsity)]); if (!passed.Keys.Contains(arr[i][2])) { passed[arr[i][2]] = 1; } else { passed[arr[i][2]] += 1; } } if(i==arr.Length-1) { ans.Add(memo[new Tuple<int, int, int>(ac, penalty, univarsity)]); } if (ans.Count == k) break; } ans.ForEach(Console.WriteLine); } } }