結果
問題 | No.571 3人兄弟(その2) |
ユーザー | Grenache |
提出日時 | 2017-10-07 11:09:32 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 114 ms / 2,000 ms |
コード長 | 1,367 bytes |
コンパイル時間 | 3,466 ms |
コンパイル使用メモリ | 76,592 KB |
実行使用メモリ | 56,296 KB |
最終ジャッジ日時 | 2023-08-10 19:25:41 |
合計ジャッジ時間 | 5,812 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 111 ms
55,396 KB |
testcase_01 | AC | 113 ms
56,220 KB |
testcase_02 | AC | 113 ms
56,096 KB |
testcase_03 | AC | 111 ms
56,004 KB |
testcase_04 | AC | 112 ms
55,752 KB |
testcase_05 | AC | 111 ms
56,296 KB |
testcase_06 | AC | 110 ms
56,292 KB |
testcase_07 | AC | 114 ms
55,420 KB |
testcase_08 | AC | 111 ms
55,900 KB |
testcase_09 | AC | 111 ms
55,820 KB |
testcase_10 | AC | 110 ms
55,884 KB |
testcase_11 | AC | 109 ms
56,144 KB |
testcase_12 | AC | 112 ms
56,052 KB |
testcase_13 | AC | 111 ms
56,024 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder571 { private static Scanner sc; private static Printer pr; private static void solve() { List<Pair> hw = new ArrayList<>(); for (int i = 0; i < 3; i++) { int h = sc.nextInt(); int w = sc.nextInt(); hw.add(new Pair(h, w, (char)('A' + i))); } Collections.sort(hw); for (Pair e : hw) { pr.println(e.c); } } private static class Pair implements Comparable<Pair> { int a; int b; char c; Pair(int a, int b, char c) { this.a = a; this.b = b; this.c = c; } @Override public int compareTo(Pair o) { if (a == o.a) { return Integer.compare(b, o.b); } return Integer.compare(o.a, a); } @Override public int hashCode() { return Integer.hashCode(a); } @Override public String toString() { // [xxx, xxxx] StringBuilder stmp = new StringBuilder(32); stmp.append('['); stmp.append(a); stmp.append(','); stmp.append(' '); stmp.append(b); stmp.append(']'); return stmp.toString(); } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }