結果

問題 No.24 数当てゲーム
ユーザー soragsorag
提出日時 2022-08-15 18:20:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 915 bytes
コンパイル時間 697 ms
コンパイル使用メモリ 81,532 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 05:44:20
合計ジャッジ時間 1,333 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define all(x) begin(x),end(x)
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    int ans1=100, ans2=100,sum=0,f=0,g=0 ,h=0;
    string r;
    int n,b,c,d,e;
    cin>>n;
    vector<int> a(10),x(10);
    for(int i=0;i<10;i++){
        a[i]++;
    }
    
    for(int i=0;i<n;i++){
        cin>>b>>c>>d>>e>>r;
        if(r=="YES") {
            x[b]++; x[c]++; x[d]++; x[e]++; g++;
        }
        else{
            a[b]=0; a[c]=0; a[d]=0;a[e]=0;
        }
    }
    
    for(int i=0;i<10;i++){
        if(x[i]==g and a[i]!=0) ans2=i;
    
    }
    
    for(int i=0;i<10;i++){
        sum+=a[i];
        if(a[i]!=0) f=i;
    }
    if(sum==1) ans1=f;
   
    if(ans1!=100) cout<<ans1<<endl;
    else if(ans2!=100) cout<<ans2<<endl;
    return 0;
}
  
    

0