結果
| 問題 | 
                            No.1777 万華鏡美術館
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-12-06 13:22:44 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 559 bytes | 
| コンパイル時間 | 2,000 ms | 
| コンパイル使用メモリ | 200,580 KB | 
| 最終ジャッジ日時 | 2025-01-26 05:33:46 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 5 WA * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main() {
    int N, M;
    cin >> N >> M;
    if(M == 0) {
        cout << 5 << endl;
        return 0;
    }
    vector<P> es(M);
    for(int i=0;i<M;i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        es[i] = {u, v};
    }
    sort(es.begin(), es.end());
    
    for(int i=0;i<M;i++) {
        auto [u, v] = es[i];
        int d = v - u;
        if(d % 2 == 0) {
            cout << 5 << endl;
            return 0;
        }
    }
    cout << 4 << endl;
}