結果

問題 No.216 FAC
ユーザー shioyashioya
提出日時 2018-07-27 21:37:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,330 bytes
コンパイル時間 1,190 ms
コンパイル使用メモリ 59,488 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 03:17:14
合計ジャッジ時間 2,571 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.216 FAC
#include<iostream>
#include<vector>
using namespace std;
class FAC_member{
    public:
        int point=0;
        int type =0;
};

FAC_member call_backFmm(int _point,int _type){
    FAC_member _fac;
    _fac.point = _point;
    _fac.type = _type;
    return _fac;
}

int main()
{
    int N=0;
    int player_point = 0;
    cin>>N;
    int* point = new int[N];
    vector<FAC_member>member;
    for(int i=0;i<N;i++)cin>>point[i];
    int tmp_i;
    bool fail_flag=true;
    for(int i=0;i<N;i++){
        cin>>tmp_i;
        if(tmp_i ==0){
            player_point +=point[i];
            fail_flag=false;
            goto SKIP;
        }
        for(int j=0;j<member.size();j++){
            if(member[j].type == tmp_i){
                member[j].point +=point[i];
                fail_flag =false;
                break;
            } 
        }
SKIP:
        if(fail_flag){
        member.push_back(call_backFmm(point[i],tmp_i));
        
        }
        fail_flag=true;
    }
    fail_flag =false;
    for(int i=0;i<member.size();i++){
        //cout<<"point="<<member[i].point<<"\ttype="<<member[i].type<<endl;
        if(member[i].point >player_point){
            fail_flag = true;
        }
    }
    if(fail_flag)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    //cout<<player_point<<endl;
    return 0;
}
0