結果
問題 |
No.3041 非対称じゃんけん
|
ユーザー |
![]() |
提出日時 | 2025-03-01 23:59:16 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,005 bytes |
コンパイル時間 | 2,394 ms |
コンパイル使用メモリ | 79,416 KB |
実行使用メモリ | 69,120 KB |
最終ジャッジ日時 | 2025-03-01 23:59:38 |
合計ジャッジ時間 | 20,979 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 TLE * 4 -- * 1 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int f = Integer.parseInt(sa[1]); int[] a = na(br, n); int[] b = na(br, n); int[] c = na(br, n); br.close(); BigInteger dp = BigInteger.ONE; PrintWriter pw = new PrintWriter(System.out); for (int i = 0; i < n; i++) { BigInteger dp1 = dp.shiftLeft(a[i]); BigInteger dp2 = dp.shiftLeft(b[i]); BigInteger dp3 = dp.shiftLeft(c[i]); dp = dp1.or(dp2).or(dp3); pw.println(dp.bitCount()); } pw.flush(); } static int[] na(BufferedReader br, int n) throws Exception { String[] sa = br.readLine().split(" "); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sa[i]); } return a; } }