結果

問題 No.583 鉄道同好会
ユーザー conankun
提出日時 2017-10-28 07:11:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 926 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 65,500 KB
実行使用メモリ 11,504 KB
最終ジャッジ日時 2024-11-22 02:51:42
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    
    cin >> n >> m;

    vector<vector<int>> line(150000, {0, 0});
    vector<bool> stop(150000, false);

    for (int i = 0; i < m; i++) {
        int s, t;
        cin >> s >> t;
        line[m][0] = s;
        line[m][1] = t;
        stop[s] = !stop[s];
        stop[t] = !stop[t];
    }

    int count = 0;
    string yes = "YES";
    for (int i = 0; i < m; i++) {
        if (stop[line[m][0]] && stop[line[m][1]]) {
            yes = "NO";
            break;
        }
        else if (stop[line[m][0]] || stop[line[m][1]]) {
            count++;
            if (count >= 3) {
                yes = "NO";
                break;
            }
        }
    }

    cout << yes << "\n";
    
    int a;
    cin >> a;
}
0