結果

問題 No.1885 Flat Permutation
ユーザー tentententen
提出日時 2023-03-28 11:52:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,114 bytes
コンパイル時間 4,268 ms
コンパイル使用メモリ 84,584 KB
実行使用メモリ 53,608 KB
最終ジャッジ日時 2023-10-20 06:59:21
合計ジャッジ時間 10,182 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
53,536 KB
testcase_01 AC 57 ms
53,520 KB
testcase_02 AC 58 ms
53,528 KB
testcase_03 WA -
testcase_04 AC 57 ms
52,476 KB
testcase_05 AC 58 ms
53,540 KB
testcase_06 AC 56 ms
53,532 KB
testcase_07 AC 57 ms
53,532 KB
testcase_08 AC 57 ms
52,420 KB
testcase_09 AC 56 ms
53,532 KB
testcase_10 AC 56 ms
53,524 KB
testcase_11 AC 57 ms
53,524 KB
testcase_12 AC 58 ms
53,544 KB
testcase_13 AC 56 ms
52,500 KB
testcase_14 AC 58 ms
53,532 KB
testcase_15 AC 57 ms
53,520 KB
testcase_16 AC 56 ms
53,528 KB
testcase_17 AC 56 ms
53,524 KB
testcase_18 AC 57 ms
53,524 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 58 ms
53,520 KB
testcase_24 AC 56 ms
53,528 KB
testcase_25 AC 57 ms
53,540 KB
testcase_26 AC 56 ms
51,488 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 56 ms
53,528 KB
testcase_33 AC 57 ms
53,520 KB
testcase_34 AC 57 ms
53,476 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 57 ms
53,524 KB
testcase_38 AC 56 ms
53,532 KB
testcase_39 AC 57 ms
53,528 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    static final int MOD = 998244353;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int left = Math.min(x, y);
        int right = Math.max(x, y);
        if (left > 1) {
            left++;
        }
        if (right < n) {
            right--;
        }
        if (left > right) {
            System.out.println(0);
        } else {
            System.out.println(pow(2, (right - left) / 3));
        }
    }
    
    static long pow(long x, int p) {
        if (p == 0) {
            return 1;
        } else if (p % 2 == 0) {
            return pow(x * x % MOD, p / 2);
        } else {
            return pow(x, p - 1) * x % MOD;
        }
    } 
}
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