結果
問題 | No.449 ゆきこーだーの雨と雪 (4) |
ユーザー | りあん |
提出日時 | 2016-11-16 15:48:16 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,446 bytes |
コンパイル時間 | 1,170 ms |
コンパイル使用メモリ | 112,276 KB |
実行使用メモリ | 64,280 KB |
最終ジャッジ日時 | 2023-10-22 08:31:16 |
合計ジャッジ時間 | 122,458 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
28,020 KB |
testcase_01 | AC | 45 ms
28,020 KB |
testcase_02 | AC | 43 ms
27,944 KB |
testcase_03 | AC | 57 ms
28,032 KB |
testcase_04 | AC | 55 ms
28,036 KB |
testcase_05 | AC | 57 ms
28,032 KB |
testcase_06 | AC | 54 ms
28,036 KB |
testcase_07 | AC | 56 ms
28,036 KB |
testcase_08 | AC | 54 ms
28,036 KB |
testcase_09 | AC | 56 ms
28,036 KB |
testcase_10 | AC | 53 ms
28,036 KB |
testcase_11 | AC | 54 ms
28,036 KB |
testcase_12 | AC | 2,461 ms
51,276 KB |
testcase_13 | AC | 3,965 ms
54,856 KB |
testcase_14 | AC | 3,227 ms
55,352 KB |
testcase_15 | AC | 4,290 ms
57,460 KB |
testcase_16 | AC | 3,568 ms
55,876 KB |
testcase_17 | AC | 3,569 ms
56,052 KB |
testcase_18 | AC | 2,475 ms
51,280 KB |
testcase_19 | AC | 3,203 ms
55,288 KB |
testcase_20 | AC | 3,211 ms
55,208 KB |
testcase_21 | AC | 3,934 ms
54,800 KB |
testcase_22 | AC | 3,965 ms
54,840 KB |
testcase_23 | AC | 2,462 ms
51,276 KB |
testcase_24 | AC | 3,584 ms
56,048 KB |
testcase_25 | AC | 2,043 ms
49,900 KB |
testcase_26 | AC | 1,653 ms
48,148 KB |
testcase_27 | AC | 3,931 ms
54,856 KB |
testcase_28 | AC | 3,951 ms
54,848 KB |
testcase_29 | AC | 3,198 ms
55,216 KB |
testcase_30 | AC | 4,330 ms
57,448 KB |
testcase_31 | AC | 3,950 ms
54,860 KB |
testcase_32 | AC | 3,210 ms
55,328 KB |
testcase_33 | AC | 3,573 ms
56,132 KB |
testcase_34 | AC | 2,076 ms
50,136 KB |
testcase_35 | AC | 4,336 ms
57,452 KB |
testcase_36 | AC | 2,088 ms
50,100 KB |
testcase_37 | TLE | - |
testcase_38 | AC | 3,406 ms
57,712 KB |
testcase_39 | AC | 2,928 ms
57,712 KB |
testcase_40 | AC | 3,473 ms
57,712 KB |
testcase_41 | AC | 4,963 ms
57,704 KB |
testcase_42 | AC | 4,972 ms
57,704 KB |
testcase_43 | AC | 1,974 ms
52,824 KB |
testcase_44 | AC | 3,084 ms
55,768 KB |
testcase_45 | TLE | - |
コンパイルメッセージ
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.IO; using System.Text; class contestant { static int n; static int[] lev; static int[] counts; public string name; public int sum = 0; public long uniscore = 0; public long preuni = 0; public static void init(int _n, int[] _lev) { n = _n; lev = _lev; counts = new int[n]; } public contestant(string name) { this.name = name; } public long submit(char c, int t) { int p = c - 'A'; sum += lev[p] * 50 + (int)(lev[p] * 50 / (1 + 0.2 * counts[p]) + 1e-9); ++counts[p]; preuni = uniscore; return uniscore = (long)sum * 100000 - t; } } class Program { static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; static void Main() { var sc = new Scan(); int n = sc.Int; var lev = sc.IntArr; contestant.init(n, lev); var id = new SortedDictionary<string, int>(); var lis = new List<contestant>(); var uniscore = new List<long>(); var zip = new SortedDictionary<long, int>(); int t = sc.Int; var np = new string[t][]; var unis = new long[t]; var preuni = new long[t]; uniscore.Add(0); for (int i = 0; i < t; i++) { np[i] = sc.StrArr; if (np[i][1] == "?") { unis[i] = lis[id[np[i][0]]].uniscore; continue; } if (!id.ContainsKey(np[i][0])) { id.Add(np[i][0], lis.Count); lis.Add(new contestant(np[i][0])); } else { preuni[i] = lis[id[np[i][0]]].uniscore; } unis[i] = lis[id[np[i][0]]].submit(np[i][1][0], i); uniscore.Add(unis[i]); } uniscore.Sort(); int lim = uniscore.Count; for (int i = 0; i < lim; i++) { zip.Add(uniscore[i], i + 1); } var bit = new BIT(lim + 1); for (int i = 0; i < t; ++i) { int zuni = zip[unis[i]]; if (np[i][1] == "?") { sw.WriteLine(bit.sum(zuni, lim + 1)); continue; } bit.add(zip[preuni[i]], -1); bit.add(zuni, 1); } sw.Flush(); } static void Prt<T>(IEnumerable<T> a) => sw.WriteLine(string.Join(" ", a)); } class Scan { public int Int => int.Parse(Str); public long Long => long.Parse(Str); public double Double => double.Parse(Str); public string Str => Console.ReadLine().Trim(); public int[] IntArr => StrArr.Select(int.Parse).ToArray(); public long[] LongArr => StrArr.Select(long.Parse).ToArray(); public double[] DoubleArr => StrArr.Select(double.Parse).ToArray(); public string[] StrArr => Str.Split(); } class BIT { int n; long[] bit; public BIT(int n) { this.n = n; bit = new long[n]; } public void add(int j, long w) { for (int i = j; i < n; i |= i + 1) bit[i] += w; } // [0, j) public long sum(int j) { long ret = 0; for (int i = j - 1; i >= 0; i = (i & (i + 1)) - 1) ret += bit[i]; return ret; } // [j, k) public long sum(int j, int k) => sum(k) - sum(j); }