結果
問題 | No.282 おもりと天秤(2) |
ユーザー | 紙ぺーぱー |
提出日時 | 2015-08-22 11:51:44 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 4,057 ms / 5,000 ms |
コード長 | 2,246 bytes |
コンパイル時間 | 2,159 ms |
コンパイル使用メモリ | 105,736 KB |
実行使用メモリ | 43,176 KB |
平均クエリ数 | 440.67 |
最終ジャッジ日時 | 2023-09-23 21:21:53 |
合計ジャッジ時間 | 39,043 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 89 ms
37,016 KB |
testcase_01 | AC | 106 ms
36,904 KB |
testcase_02 | AC | 92 ms
37,092 KB |
testcase_03 | AC | 88 ms
36,484 KB |
testcase_04 | AC | 84 ms
38,812 KB |
testcase_05 | AC | 97 ms
36,640 KB |
testcase_06 | AC | 109 ms
38,460 KB |
testcase_07 | AC | 87 ms
39,032 KB |
testcase_08 | AC | 109 ms
36,888 KB |
testcase_09 | AC | 84 ms
36,312 KB |
testcase_10 | AC | 1,044 ms
42,744 KB |
testcase_11 | AC | 3,633 ms
38,608 KB |
testcase_12 | AC | 1,155 ms
43,176 KB |
testcase_13 | AC | 1,747 ms
42,952 KB |
testcase_14 | AC | 2,958 ms
40,776 KB |
testcase_15 | AC | 3,691 ms
42,844 KB |
testcase_16 | AC | 291 ms
40,632 KB |
testcase_17 | AC | 1,574 ms
42,744 KB |
testcase_18 | AC | 2,593 ms
40,900 KB |
testcase_19 | AC | 2,771 ms
42,900 KB |
testcase_20 | AC | 4,057 ms
39,276 KB |
testcase_21 | AC | 3,868 ms
42,896 KB |
testcase_22 | AC | 3,918 ms
40,612 KB |
testcase_23 | AC | 82 ms
38,916 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.Collections.Generic; using Debug = System.Diagnostics.Debug; using StringBuilder = System.Text.StringBuilder; using System.Numerics; using static System.Linq.Enumerable; using static System.Math; namespace Program { public class Solver { /// <summary> /// Odd-even sort /// </summary> public void Solve() { var n = int.Parse(Console.ReadLine()); var A = Enumerate(n, x => x + 1); for (int _ = 0; _ < n; _++) { var B = new int[2 * n]; for (int i = 0; i + 2 <= n; i += 2) { B[i] = A[i]; B[i + 1] = A[i + 1]; } Console.WriteLine("? {0}", B.AsJoinedString()); var ans = Console.ReadLine().Split(); for (int i = 0; i * 2 < n; i++) { if (ans[i] == ">") Swap(ref A[i * 2], ref A[i * 2 + 1]); } Array.Clear(B, 0, n); for (int i = 0; i + 2 < n; i += 2) { B[i] = A[i + 1]; B[i + 1] = A[i + 2]; } Console.WriteLine("? {0}", B.AsJoinedString()); ans = Console.ReadLine().Split(); for (int i = 0; i * 2 < n; i++) { if (ans[i] == ">") Swap(ref A[i * 2 + 1], ref A[i * 2 + 2]); } } Console.WriteLine("! {0}", A.AsJoinedString()); } static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; } static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; } } } #region main static class Ex { static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); } static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); } static public void Main() { var solver = new Program.Solver(); solver.Solve(); } } #endregion