結果

問題 No.1777 万華鏡美術館
ユーザー KKT89KKT89
提出日時 2021-12-06 06:24:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,438 bytes
コンパイル時間 1,635 ms
コンパイル使用メモリ 139,120 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 15:04:57
合計ジャッジ時間 2,275 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <sstream>
#include <utility>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <array>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}
inline double time() {
    return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    bool f = (n%2 == 0 and m == 0);
    vector<pair<int,int>> v(m);
    for(int i=0;i<m;i++){
        cin >> v[i].first >> v[i].second;
    }
    if(m){
        vector<int> vv;
        for(auto p:v){
            vv.push_back(p.first);
            vv.push_back(p.second);
        }
        sort(vv.begin(), vv.end());
        vv.erase(unique(vv.begin(), vv.end()),vv.end());
        vv.push_back(vv[0]+n);
        for(int j=0;j+1<vv.size();j++){
            if(vv[j]%2 == vv[j+1]%2) f = true;
        }
    }
    cout << 4+(f?1:0) << endl;
}
0