結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー kuuso1
提出日時 2016-11-18 23:00:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 2,077 bytes
コンパイル時間 1,001 ms
コンパイル使用メモリ 112,548 KB
実行使用メモリ 32,212 KB
最終ジャッジ日時 2024-11-26 07:48:18
合計ジャッジ時間 3,079 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var score = new Dictionary<String,int[]>();
		var lastAC = new Dictionary<String,int>();
		var Inf = (int) 1e9;
		int[] AC = new int[N];
		
		
		for(int i=0;i<T;i++){
			var ss = In[i].Split(' ');
			if(score.ContainsKey(ss[0]) == false){
				score.Add(ss[0],new int[N]);
				lastAC.Add(ss[0],Inf);
			}
			AC[ss[1][0] - 'A']++;
			score[ss[0]][ss[1][0] - 'A'] += (int)(A[ss[1][0] - 'A'] * 50.0 + A[ss[1][0] - 'A'] * 50.0 / (0.8 + 0.2 * AC[ss[1][0] - 'A']));
			lastAC[ss[0]] = i;
		}
		
		List<Pair> P = new List<Pair>();
		
		foreach(var s in score.Keys){
			P.Add(new Pair(s,score[s].Sum(),lastAC[s]));
		}
		
		P.Sort((p,q) => {
			if( p.Score.CompareTo(q.Score) != 0) return - p.Score.CompareTo(q.Score);
			return p.LastAC.CompareTo(q.LastAC);
		});
		
		for(int i=0;i<P.Count;i++){
			Console.WriteLine("{0} {1} {2} {3}",i+1,P[i].Name,String.Join(" ",score[P[i].Name]),P[i].Score);
		}
		
		
		
		
	}
	
	class Pair{
		public String Name;
		public int Score;
		public int LastAC;
		public Pair(String n,int s,int l){
			Name = n; Score = s; LastAC = l;
		}
	}
	
	int N;
	int[] A;
	int T;
	String[] In;
	public Sol(){
		N = ri();
		A = ria();
		T = ri();
		In = new String[T];
		for(int i=0;i<T;i++) In[i] = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0