結果
問題 | No.2403 "Eight" Bridges of Königsberg |
ユーザー |
![]() |
提出日時 | 2023-08-04 22:00:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 510 bytes |
コンパイル時間 | 1,745 ms |
コンパイル使用メモリ | 194,792 KB |
最終ジャッジ日時 | 2025-02-15 22:44:31 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 8 WA * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ll N, M, a, b, mx=0; bool f=0, g=0; cin >> N >> M; vector<ll> deg(N); for (int i=0; i<M; i++){ cin >> a >> b; a--; b--; deg[a]--; deg[b]++; } for (int i=0; i<N; i++) if (deg[i] > 0) mx++; for (int i=0; i<N; i++){ if (deg[i] > 0) f=1; else if (deg[i] < 0) g=1; } if (f & g) mx = max(0LL, mx-1); cout << mx << endl; return 0; }