結果

問題 No.2403 "Eight" Bridges of Königsberg
ユーザー erbowl
提出日時 2023-08-04 21:53:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 1,600 ms
コンパイル使用メモリ 195,424 KB
最終ジャッジ日時 2025-02-15 22:39:20
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;

#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n,m;
    std::cin >> n>>m;
    vector<ll> nyu(n),shu(n);
    for (int i = 0; i < m; i++) {
        ll u,v;
        std::cin >> u>>v;
        u--;v--;
        shu[u]++;
        nyu[v]++;
    }
    ll p = 0;
    for (int i = 0; i < n; i++) {
        // std::cout << shu[i]<<" "<<nyu[i] << std::endl;
        if(shu[i]-nyu[i]>0){
            p += shu[i]-nyu[i];
        }
    }
    std::cout << max(0ll,p-1) << std::endl;
};
0