結果

問題 No.1717 Levi-Civita Triangle
ユーザー hari64hari64
提出日時 2021-10-22 22:23:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 4,021 bytes
コンパイル時間 1,502 ms
コンパイル使用メモリ 172,076 KB
実行使用メモリ 5,208 KB
最終ジャッジ日時 2023-10-24 13:39:33
合計ジャッジ時間 6,145 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 1 ms
4,348 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 2 ms
4,348 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

// clang-format off
namespace viewer {template<class T>string f(T i){string s=(i==1001001001||i==1001001001001001001?"inf":to_string(i));s=string(max(0,3-(int)s.size()),' ')+s;return s;} 
void view(const char c,string end="\n"){cerr<<c<<end;} void view(const string&s,string end="\n"){cerr<<s<<end;} template<class T>void view(const T&x,string end="\n"){cerr<<f(x)<<end;}
template<class T0,class T1>void view(const pair<T0,T1>&p,string end="\n"){cerr<<"("<<f(get<0>(p))<<", "<<f(get<1>(p))<<")"<<end;} template<class T0,class T1>void view(const tuple<T0,T1>&p,string end="\n"){cerr<<"("<<f(get<0>(p))<<", "<<f(get<1>(p))<<")"<<end;}
template<class T0,class T1,class T2>void view(const tuple<T0,T1,T2>&t,string end="\n"){cerr<<"("<<f(get<0>(t))<<", "<<f(get<1>(t));cerr<<", "<<f(get<2>(t))<<")"<<end;}
template<class T0,class T1,class T2,class T3>void view(const tuple<T0,T1,T2,T3>&t,string end="\n"){cerr<<"("<<f(get<0>(t))<<", "<<f(get<1>(t))<<", "<<f(get<2>(t))<<", "<<f(get<3>(t))<<")"<<end;}
template<class T>void view(const vector<T>&vx,string _end=""){bool is_value=is_integral<T>();cerr<<"{"<<(vx.empty()||is_value?"":"\n");for(const T&x:vx){if(!is_value)cerr<<"  ";view(x,(is_value?",":"\n"));};cerr<<"}\n"<<_end;}
template<class T>void view(const set<T>&s){vector<T>v(s.begin(),s.end());view(v);} template<class T>void view(const multiset<T>&s){vector<T>v(s.begin(),s.end());view(v);}
template<class T>void view(const unordered_set<T>&s){vector<T>v(s.begin(),s.end());view(v);} template<class T>void view(const deque<T>&s){vector<T>v(s.begin(),s.end());view(v);}
template<class T>void view(const priority_queue<T>&p){priority_queue<T>q=p;vector<T>v;while(!q.empty()){v.push_back(q.top());q.pop();}view(v);}
template<class T,class U>void view(const map<T, U>&m){cerr<<"{"<<(m.empty()?"":"\n");for(const auto&kv:m){cerr<<"  [";view(kv.first,"");cerr<<"] : ";view(kv.second,"");cerr<<"\n";}cerr<<"}\n";}
template<class T>void _view(const T&var,string var_name,int line_num){cerr<<line_num<<": "<<var_name<<" = ";view(var);}
void view_grid(const vector<vector<bool>>&vvb){cerr<<"\n";for(const vector<bool>&vb:vvb){for(const bool&b:vb)cerr<<(b?".":"#");cerr<<"\n";}}} //グリッド用 "."と"#"は交換可
// clang-format on

#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
#define debug(var) viewer::_view(var, #var, __LINE__)

constexpr int INF = 1001001001;

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

    int N;
    cin >> N;
    vector<int> As(2 * N + 1);
    for (int i = 0; i < 2 * N + 1; i++) {
        cin >> As[i];
    }
    int cnt = 0;
    while (As.size() >= 3 && cnt++ <= 3) {
        vector<int> Bs((int)As.size() - 2);
        for (int i = 1; i < (int)As.size() - 1; i++) {
            if (As[i - 1] == 0 && As[i] == 1 && As[i + 1] == 2) {
                Bs[i - 1] = 1;
            } else if (As[i - 1] == 1 && As[i] == 2 && As[i + 1] == 0) {
                Bs[i - 1] = 1;
            } else if (As[i - 1] == 2 && As[i] == 0 && As[i + 1] == 1) {
                Bs[i - 1] = 1;
            } else if (As[i - 1] == 2 && As[i] == 1 && As[i + 1] == 0) {
                Bs[i - 1] = 2;
            } else if (As[i - 1] == 1 && As[i] == 0 && As[i + 1] == 2) {
                Bs[i - 1] = 2;
            } else if (As[i - 1] == 0 && As[i] == 2 && As[i + 1] == 1) {
                Bs[i - 1] = 2;
            } else {
                Bs[i - 1] = 0;
            }
        }
        swap(As, Bs);
        // debug(As);
    }

    if (As.size() == 1) {
        cout << As[0] << endl;
        return 0;
    }

    bool is_0 = false;
    bool is_1 = false;
    bool is_2 = false;

    for (int i = 0; i < int(As.size()); i++) {
        if (As[i] == 0) {
            is_0 = true;
        } else if (As[i] == 1) {
            is_1 = true;
        } else {
            is_2 = true;
        }
    }
    assert(!(is_0 && is_1 && is_2));
    // 未証明
    cout << 0 << endl;

    return 0;
}
0