結果

問題 No.986 Present
ユーザー 37zigen37zigen
提出日時 2020-04-22 00:57:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 3,230 bytes
コンパイル時間 2,591 ms
コンパイル使用メモリ 80,196 KB
実行使用メモリ 51,820 KB
最終ジャッジ日時 2024-04-17 22:48:54
合計ジャッジ時間 9,181 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
48,032 KB
testcase_01 AC 124 ms
47,800 KB
testcase_02 AC 127 ms
48,028 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 157 ms
50,988 KB
testcase_07 AC 131 ms
48,056 KB
testcase_08 WA -
testcase_09 AC 183 ms
51,740 KB
testcase_10 AC 125 ms
47,912 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 132 ms
47,884 KB
testcase_14 AC 133 ms
48,684 KB
testcase_15 WA -
testcase_16 AC 139 ms
48,472 KB
testcase_17 AC 189 ms
51,456 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 208 ms
51,700 KB
testcase_22 WA -
testcase_23 AC 163 ms
51,632 KB
testcase_24 AC 222 ms
51,604 KB
testcase_25 AC 147 ms
50,044 KB
testcase_26 AC 217 ms
51,484 KB
testcase_27 AC 195 ms
51,684 KB
testcase_28 AC 124 ms
48,032 KB
testcase_29 AC 128 ms
47,936 KB
testcase_30 AC 124 ms
48,032 KB
testcase_31 AC 133 ms
47,916 KB
testcase_32 AC 125 ms
47,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.NoSuchElementException;


public class Main {
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	final long MOD=998244353;
	long[] p2=new long[(int)1e6];
	{
		p2[0]=1;
		for (int i=1;i<p2.length;++i) p2[i]=2*p2[i-1]%MOD;
	}
	
	long euclid(long a,long b,long p,long q) {
		return q==0?a:euclid(b,(a-p/q*b)%MOD,q,p%q);
	}
	
	long inv(long a) {
		long v=euclid(1,0,a,MOD);
		return v<0?v+MOD:v;
	}
	
	long mul(long...a) {
		long ret=1;
		for (long v:a) ret=ret*v%MOD;
		return ret;
	}
	
	long comb(int n,int k) {
		long ret=1;
		for (long i=n;i>=n-k+1;--i) ret=ret*i%MOD;
		for (long i=1;i<=k;++i) ret=ret*inv(i)%MOD;
		return ret;
	}
	
	long pow(long a,long n) {
		return n==0?1:(pow(a*a%MOD,n/2)*(n%2==1?a:1))%MOD;
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		int N=sc.nextInt();// size N
		int M=sc.nextInt();// [0,2^M)
		long v0=p2[N],v1=1,v2=1;
		for (int i=0;i<N;++i) {
			v1=mul(v1,p2[M]-p2[i],inv(i+1));
		}
		for (int i=0;i<N;++i) {
			v2=mul(p2[N]-p2[i],v2,inv(i+1));
		}
		System.out.println(v0+" "+v1+" "+mul(v1,inv(v2)));
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}




class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
    	return (int)nextLong();
    }
}
0