結果
問題 | No.8042 本棚 |
ユーザー |
![]() |
提出日時 | 2019-04-01 22:41:05 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 2,327 bytes |
コンパイル時間 | 1,008 ms |
コンパイル使用メモリ | 112,764 KB |
実行使用メモリ | 20,352 KB |
最終ジャッジ日時 | 2024-06-28 01:53:21 |
合計ジャッジ時間 | 3,088 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
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.Collections.Generic;using System.Linq;namespace No3042{public partial class Program{void Solve(StreamScanner ss, StreamWriter sw){//---------------------------------var N = ss.Next(int.Parse);var nums = "itinisanyon";var books = ss.Next(2, N).Select(a => (s: a[0], id: a[1])).OrderBy(t => t.s).ThenBy(t => nums.IndexOf(t.id));sw.WriteLine(string.Join("\n", books.Select(t => $"{t.s} {t.id}")));//---------------------------------}}public class StreamScanner{static readonly char[] Separator = { ' ' };readonly StreamReader streamReader;string[] line = new string[0];int index = 0;public StreamScanner(Stream stream){this.streamReader = new StreamReader(stream);}public string Next(){return Next(s => s);}public string[] Next(int x){return Next(s => s, x);}public string[][] Next(int x, int y){return Next(s => s, x, y);}public T Next<T>(Func<string, T> parser){if (index < line.Length) return parser(line[index++]);index = 0;line = streamReader.ReadLine()?.Split(Separator, StringSplitOptions.RemoveEmptyEntries);return Next(parser);}public T[] Next<T>(Func<string, T> parser, int x){var ret = new T[x];for (var i = 0; i < x; ++i) ret[i] = Next(parser);return ret;}public T[][] Next<T>(Func<string, T> parser, int x, int y){var ret = new T[y][];for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);return ret;}}public partial class Program{static void Main(){Excute(Console.OpenStandardInput(), Console.OpenStandardOutput());}public static void Excute(Stream input, Stream output){var ss = new StreamScanner(input);var sw = new StreamWriter(output);new Program().Solve(ss, sw);sw.Flush();}}}