結果
問題 | No.986 Present |
ユーザー | 37zigen |
提出日時 | 2020-04-22 00:57:14 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,230 bytes |
コンパイル時間 | 2,570 ms |
コンパイル使用メモリ | 84,404 KB |
実行使用メモリ | 61,804 KB |
最終ジャッジ日時 | 2024-10-09 16:31:21 |
合計ジャッジ時間 | 8,872 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 123 ms
59,256 KB |
testcase_01 | AC | 126 ms
59,164 KB |
testcase_02 | AC | 125 ms
59,324 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 151 ms
61,328 KB |
testcase_07 | AC | 130 ms
59,216 KB |
testcase_08 | WA | - |
testcase_09 | AC | 180 ms
61,664 KB |
testcase_10 | AC | 124 ms
59,048 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 127 ms
59,172 KB |
testcase_14 | AC | 136 ms
59,168 KB |
testcase_15 | WA | - |
testcase_16 | AC | 135 ms
59,168 KB |
testcase_17 | AC | 189 ms
61,588 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 206 ms
61,400 KB |
testcase_22 | WA | - |
testcase_23 | AC | 157 ms
61,532 KB |
testcase_24 | AC | 216 ms
61,572 KB |
testcase_25 | AC | 144 ms
61,360 KB |
testcase_26 | AC | 213 ms
61,656 KB |
testcase_27 | AC | 188 ms
61,668 KB |
testcase_28 | AC | 124 ms
59,240 KB |
testcase_29 | AC | 126 ms
59,156 KB |
testcase_30 | AC | 125 ms
59,200 KB |
testcase_31 | AC | 128 ms
59,288 KB |
testcase_32 | AC | 131 ms
59,168 KB |
ソースコード
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(); } }