結果
問題 | No.318 学学学学学 |
ユーザー |
![]() |
提出日時 | 2015-12-11 01:07:09 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,895 bytes |
コンパイル時間 | 916 ms |
コンパイル使用メモリ | 109,824 KB |
実行使用メモリ | 40,832 KB |
最終ジャッジ日時 | 2024-09-15 07:47:49 |
合計ジャッジ時間 | 5,447 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 150 ms
40,832 KB |
testcase_08 | AC | 143 ms
39,424 KB |
testcase_09 | AC | 141 ms
38,784 KB |
testcase_10 | AC | 131 ms
38,144 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 128 ms
36,864 KB |
testcase_18 | WA | - |
testcase_19 | AC | 131 ms
36,992 KB |
testcase_20 | WA | - |
testcase_21 | AC | 32 ms
19,328 KB |
testcase_22 | AC | 33 ms
19,328 KB |
testcase_23 | AC | 33 ms
19,328 KB |
testcase_24 | AC | 34 ms
19,328 KB |
testcase_25 | AC | 33 ms
19,328 KB |
testcase_26 | AC | 33 ms
19,072 KB |
testcase_27 | AC | 33 ms
19,456 KB |
testcase_28 | AC | 33 ms
19,456 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.IO; using System.Linq; using System.Text; using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using Enu = System.Linq.Enumerable; class Program { public void Solve() { int N = Reader.Int(); var A = Reader.IntArray(N); var sorted = A.Distinct().ToArray(); Array.Sort(sorted); var id = A.Select(a => Array.BinarySearch(sorted, a)).ToArray(); int[] L = Enu.Repeat(N, sorted.Length).ToArray(); int[] R = Enu.Repeat(-1, sorted.Length).ToArray(); for (int i = 0; i < N; i++) { int v = id[i]; L[v] = Math.Min(L[v], i); R[v] = Math.Max(R[v], i); } int[] ans = new int[N]; int LL = 0, RR = N - 1; for (int i = sorted.Length - 1; i >= 0; i--) { for (int x = L[i]; x <= RR; x++) ans[x] = sorted[i]; for (int x = LL; x <= R[i]; x++) ans[x] = sorted[i]; LL = Math.Max(LL, R[i] + 1); RR = Math.Min(RR, L[i] - 1); } Console.WriteLine(string.Join(" ", ans)); } } class Entry { static void Main() { new Program().Solve(); } } class Reader { private static TextReader reader = Console.In; private static readonly char[] separator = { ' ' }; private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries; private static string[] A = new string[0]; private static int i; private static void Init() { A = new string[0]; } public static void Set(TextReader r) { reader = r; Init(); } public static void Set(string file) { reader = new StreamReader(file); Init(); } public static bool HasNext() { return CheckNext(); } public static string String() { return Next(); } public static int Int() { return int.Parse(Next()); } public static long Long() { return long.Parse(Next()); } public static double Double() { return double.Parse(Next()); } public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); } public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); } public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); } public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Next()).ToArray(); } public static string Line() { return reader.ReadLine().Trim(); } private static string[] Split(string s) { return s.Split(separator, op); } private static string Next() { CheckNext(); return A[i++]; } private static bool CheckNext() { if (i < A.Length) return true; string line = reader.ReadLine(); if (line == null) return false; if (line == "") return CheckNext(); A = Split(line); i = 0; return true; } }