結果

問題 No.1934 Four Fruits
ユーザー orange navleorange navle
提出日時 2022-05-13 21:44:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,123 bytes
コンパイル時間 2,199 ms
コンパイル使用メモリ 205,432 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 06:48:34
合計ジャッジ時間 2,784 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;

#define rep(i,n) for(LL i=0;i<(n);i++)

template <class T>
void output(vector<T> &data){

    rep(i,data.size()){
        cout << data.at(i) << " ";
    }
    cout << endl;

}

template<>
void output(vector<string> &data){
 
    rep(i,data.size()){
        cout << data.at(i) << endl;
    }
 
}

template <class T>
void output(vector<vector<T>> &data){

    rep(i,data.size()){

        rep(j,data.at(i).size()){
            cout << data.at(i).at(j) << " ";
        }

        cout << endl;

    }

}

template <>
void output(vector<vector<bool>> &data){

    rep(i,data.size()){

        rep(j,data.at(i).size()){

            if(data.at(i).at(j)){
                cout << "*";
            }
            else{
                cout << "-";
            }

        }

        cout << endl;

    }

}

template<class T>
void input(vector<T> &data,LL n){
    
    rep(i,n){
        LL a; cin >> a;
        data.push_back(a);
    }

}

template<>
void input(vector<string> &data,LL n){

    rep(i,n){
        string s; cin >> s;
        data.push_back(s);
    }

}

template<class T>
void input(vector<vector<T>> &data,LL h, LL w){

    rep(i,h){
        vector<T> add;

        rep(j,w){
            T a; cin >> a;
            add.push_back(a);
        }

        data.push_back(add);

    }

}

int main(){
    vector<int> data(4);

    rep(i,3){
        int a; cin >> a;
        data.at(a)++;
    }

    bool full = false;
    int full_pos = -1;
    int zero_pos = -1;
    int one_pos = -1;
    int two_pos = -1;

    rep(i,data.size()){
        if(data.at(i) == 0){
            zero_pos = i;
        }
        else if(data.at(i) == 1){
            one_pos = i;
        }
        else if(data.at(i) == 2){
            two_pos = i;
        }
        else if(data.at(i) == 3){
            full_pos = i;
        }
    }

    int ans = -1;

    if(full_pos != -1){
        ans = full_pos;
    }
    else if(two_pos != -1){
        ans = one_pos;
    }
    else{
        ans = zero_pos;
    }

    cout << ans << endl;

    return 0;
}
0