結果

問題 No.2521 Don't be Same
ユーザー tentententen
提出日時 2023-11-01 13:40:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 3,153 bytes
コンパイル時間 2,884 ms
コンパイル使用メモリ 95,168 KB
実行使用メモリ 71,004 KB
平均クエリ数 2.18
最終ジャッジ日時 2023-11-01 13:40:45
合計ジャッジ時間 9,693 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
70,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 120 ms
69,932 KB
testcase_11 AC 128 ms
67,412 KB
testcase_12 AC 125 ms
67,152 KB
testcase_13 AC 121 ms
69,928 KB
testcase_14 AC 121 ms
69,928 KB
testcase_15 AC 121 ms
70,012 KB
testcase_16 AC 120 ms
68,760 KB
testcase_17 AC 121 ms
69,924 KB
testcase_18 AC 119 ms
70,008 KB
testcase_19 AC 121 ms
70,024 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 WA -
testcase_27 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int x = sc.nextInt();
        int y = sc.nextInt();
        if ((x < y && x % 2 == 1) || (x > y && y % 2 == 1)) {
            System.out.println("Second");
            System.out.flush();
            String type = sc.next();
            if (type.equals("A")) {
                int a = sc.nextInt();
                int b = sc.nextInt();
                if (a == 1) {
                    x -= b;
                } else {
                    y -= b;
                }
            } else {
                return;
            }
        } else {
            System.out.println("First");
            System.out.flush();
        }
        while (true) {
            if (x == y) {
                System.out.println("B");
            } else if (x == 0) {
                System.out.println("A 2 " + y);
            } else if (y == 0) {
                System.out.println("A 1 " + x);
            } else if (x < y) {
                if (x % 2 == 0) {
                    System.out.println("A 2 " + (y - x + 1));
                } else {
                    System.out.println("A 2 " + (y - x - 1));
                }
            } else {
                if (y % 2 == 0) {
                    System.out.println("A 1 " + (x - y + 1));
                } else {
                    System.out.println("A 1 " + (x - y - 1));
                }
            }
            System.out.flush();
            String type = sc.next();
            if (type.equals("A")) {
                int a = sc.nextInt();
                int b = sc.nextInt();
                if (a == 1) {
                    x -= b;
                } else {
                    y -= b;
                }
            } else {
                return;
            }
        }
    }
    
} 
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0