結果

問題 No.24 数当てゲーム
コンテスト
ユーザー latte0119
提出日時 2015-04-30 21:36:39
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 573 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 914 ms
コンパイル使用メモリ 175,496 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-27 02:23:16
合計ジャッジ時間 1,354 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:71,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
                 from main.cpp:1:
In member function 'bool __gnu_cxx::__ops::_Iter_equals_val<_Value>::operator()(_Iterator) [with _Iterator = int*; _Value = const int]',
    inlined from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = int*; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:2095:42,
    inlined from '_IIter std::find(_IIter, _IIter, const _Tp&) [with _IIter = int*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algo.h:3895:28,
    inlined from 'int main()' at main.cpp:14:24:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/predefined_ops.h:270:24: warning: iteration 4 invokes undefined behavior [-Waggressive-loop-optimizations]
  270 |         { return *__it == _M_value; }
      |                  ~~~~~~^~~~~~~~~~~
main.cpp: In function 'int main()':
main.cpp:13:26: note: within this loop
   13 |             for(int j=0;j<10;j++){
      |                         ~^~~

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    bool f[10]={0};
    while(N--){
        int a[4];
        string str;
        for(int i=0;i<4;i++)cin>>a[i];
        cin>>str;
        if(str=="YES"){
            for(int j=0;j<10;j++){
                if(find(a,a+4,a[j])!=a+4)continue;
                f[j]=true;
            }
        }
        else{
            for(int j=0;j<4;j++)f[a[j]]=true;
        }
    }

    for(int i=0;i<10;i++){
        if(!f[i]){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}
0