結果
問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
ユーザー |
👑 ![]() |
提出日時 | 2021-07-21 22:22:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 832 bytes |
コンパイル時間 | 799 ms |
コンパイル使用メモリ | 82,460 KB |
最終ジャッジ日時 | 2025-01-23 04:33:01 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 11 WA * 21 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) int N,M; vector<vector<int>> E; vector<int> I; int main(){ cin >> N >> M; E.resize(N); I.assign(N,0); rep(i,M){ int u,v; cin >> u >> v; u--; v--; E[u].push_back(v); E[v].push_back(u); I[u]++; I[v]++; } int ans = 0; while(true){ int id = -1; rep(i,N) if(I[i] == 1) id = i; if(id == -1) break; cout << "id = " << id << endl; I[id]--; for(int e : E[id]) I[e]--; ans ^= 1; } cout << vector<string>{"No\n","Yes\n"}[ans]; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;