結果
問題 | No.2823 PEX (Predecessing Excluded Value) Game |
ユーザー |
|
提出日時 | 2024-06-21 17:10:44 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 1,824 ms / 2,000 ms |
コード長 | 505 bytes |
コンパイル時間 | 2,602 ms |
コンパイル使用メモリ | 78,500 KB |
実行使用メモリ | 74,304 KB |
最終ジャッジ日時 | 2024-07-27 21:24:08 |
合計ジャッジ時間 | 17,844 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
import java.util.Scanner; import java.util.HashMap; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long bef = 0; long sum = 0; HashMap<Long,Long> map = new HashMap<>(); while(N-->0){ long L = sc.nextLong()-1; long R = sc.nextLong(); sum += L-bef; if(sum%2==1) map.merge(sum,R-L,Long::sum); bef = R; } long g = 0; for(long num:map.values()) g ^= num; System.out.println(g>0?"First":"Second"); } }