結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー Irmystp
提出日時 2014-12-02 23:13:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 1,447 ms
コンパイル使用メモリ 159,708 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 07:18:07
合計ジャッジ時間 2,448 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d", &N);
      |     ~~~~~^~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d", L+x);
      |         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int N;
int L[100000];

int main(){
    scanf("%d", &N);
    for(int x = 0; x < N; x++){
        scanf("%d", L+x);
    }
    sort(L, L+N);
    int max_v = 0, lv;
    for(int x = 1; x <= 6; x++){
        int* lb = lower_bound(L, L+N, x);
        int* ub = upper_bound(L, L+N, x);
        if(ub - lb >= max_v){
            max_v = ub - lb;
            lv = x;
        }
    }
    printf("%d\n", lv);
    return 0;
}
0