結果
| 問題 |
No.2403 "Eight" Bridges of Königsberg
|
| コンテスト | |
| ユーザー |
憩いの場
|
| 提出日時 | 2023-08-09 22:15:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 552 bytes |
| コンパイル時間 | 626 ms |
| コンパイル使用メモリ | 68,608 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-15 20:22:49 |
| 合計ジャッジ時間 | 2,817 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 WA * 10 |
ソースコード
#include<iostream>
#include<vector>
using namespace std;
int main( void )
{
int N, M;
cin >> N >> M;
vector<int> in( N + 1, 0 ), out( N + 1, 0 );
int u, v;
for( int i = 0; i < M; i++ )
{
cin >> u >> v;
if( u == v ) continue;
in[v]++, out[u]++;
}
int num = 0;
for( int i = 1; i <= N; i++ )
{
num += abs( in[i] - out[i] );
}
if( num == 0 || num == 2 )
{
cout << 0 << endl;
}
else
{
cout << num / 2 - 1 << endl;
}
return 0;
}
憩いの場