結果

問題 No.986 Present
ユーザー 37zigen37zigen
提出日時 2020-04-22 00:57:14
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 3,230 bytes
コンパイル時間 2,688 ms
コンパイル使用メモリ 78,188 KB
実行使用メモリ 62,252 KB
最終ジャッジ日時 2023-07-30 21:32:33
合計ジャッジ時間 9,462 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
59,876 KB
testcase_01 AC 112 ms
60,184 KB
testcase_02 AC 113 ms
60,108 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 141 ms
61,856 KB
testcase_07 AC 117 ms
59,760 KB
testcase_08 WA -
testcase_09 AC 167 ms
61,732 KB
testcase_10 AC 112 ms
59,688 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 114 ms
59,764 KB
testcase_14 AC 121 ms
59,840 KB
testcase_15 WA -
testcase_16 AC 124 ms
59,752 KB
testcase_17 AC 178 ms
61,784 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 191 ms
61,644 KB
testcase_22 WA -
testcase_23 AC 146 ms
61,784 KB
testcase_24 AC 203 ms
61,756 KB
testcase_25 AC 132 ms
61,864 KB
testcase_26 AC 201 ms
61,940 KB
testcase_27 AC 178 ms
61,724 KB
testcase_28 AC 112 ms
59,660 KB
testcase_29 AC 111 ms
61,692 KB
testcase_30 AC 110 ms
59,716 KB
testcase_31 AC 111 ms
59,672 KB
testcase_32 AC 113 ms
59,752 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