結果

問題 No.216 FAC
ユーザー shioyashioya
提出日時 2018-07-27 21:12:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,277 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 60,512 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-18 01:46:14
合計ジャッジ時間 2,179 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 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 exist_flag=false;
    for(int i=0;i<N;i++){
        cin>>tmp_i;
        for(int j=0;j<member.size();j++){
            if(member[j].type == tmp_i){
                member[j].point +=point[i];
                exist_flag = false;
                break;
            } 
            if(tmp_i ==0){
                player_point +=point[i];
                break;
            }

        }
        if(!exist_flag){
        member.push_back(call_backFmm(tmp_i,point[i]));
        exist_flag=true;
        }
    }
    bool fail_flag =false;
    for(int i=0;i<member.size();i++){
        //cout<<member[i].point<<"\t"<<member[i].type<<endl;
        if(member[i].point >player_point){
            fail_flag = true;
            
        }
    }
    if(fail_flag)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}
0