結果
問題 | No.1610 She Loves Me, She Loves Me Not, ... |
ユーザー | merlin |
提出日時 | 2021-07-21 22:12:10 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,439 bytes |
コンパイル時間 | 2,862 ms |
コンパイル使用メモリ | 76,276 KB |
実行使用メモリ | 58,228 KB |
最終ジャッジ日時 | 2023-09-24 18:02:28 |
合計ジャッジ時間 | 7,431 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
49,740 KB |
testcase_01 | AC | 71 ms
51,748 KB |
testcase_02 | AC | 45 ms
49,668 KB |
testcase_03 | AC | 44 ms
49,752 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 146 ms
55,600 KB |
testcase_07 | AC | 147 ms
55,420 KB |
testcase_08 | AC | 148 ms
55,424 KB |
testcase_09 | WA | - |
testcase_10 | AC | 147 ms
55,540 KB |
testcase_11 | AC | 147 ms
55,776 KB |
testcase_12 | AC | 150 ms
55,436 KB |
testcase_13 | AC | 151 ms
55,404 KB |
testcase_14 | AC | 62 ms
49,816 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 62 ms
49,872 KB |
testcase_18 | AC | 63 ms
50,596 KB |
testcase_19 | AC | 63 ms
49,792 KB |
testcase_20 | WA | - |
testcase_21 | AC | 62 ms
50,876 KB |
testcase_22 | WA | - |
testcase_23 | AC | 45 ms
49,656 KB |
testcase_24 | AC | 45 ms
50,100 KB |
testcase_25 | AC | 45 ms
49,656 KB |
testcase_26 | AC | 46 ms
49,708 KB |
testcase_27 | AC | 46 ms
49,924 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
ソースコード
import java.io.*; import java.util.*; class Main { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); String s[]=bu.readLine().split(" "); int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]); ArrayList<Integer> g[]=new ArrayList[n]; int i,c[]=new int[n]; for(i=0;i<n;i++) g[i]=new ArrayList<>(); for(i=0;i<m;i++) { s=bu.readLine().split(" "); int u=Integer.parseInt(s[0])-1,v=Integer.parseInt(s[1])-1; g[u].add(v); g[v].add(u); c[u]++; c[v]++; } int ans=0; PriorityQueue<int[]> pq=new PriorityQueue<>(new Comparator<int[]>() { @Override public int compare(int[] o1, int[] o2) { if(o1[1]>o2[1]) return 1; else return -1; }}); for(i=0;i<n;i++) pq.add(new int[]{i,c[i]}); while(!pq.isEmpty()) { int a[]=pq.poll(); if(c[a[0]]==0 || c[a[0]]<a[1]) continue; ans++; c[a[0]]=0; for(int x:g[a[0]]) { c[x]--; if(c[x]>0) pq.add(new int[]{x,c[x]}); } } if(ans%2==0) sb.append("No"); else sb.append("Yes"); System.out.println(sb); } }