結果

問題 No.647 明太子
ユーザー るさるさ
提出日時 2018-05-30 18:13:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 984 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 26,868 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 20:44:08
合計ジャッジ時間 1,988 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    int mb[n][2];
    for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
            scanf("%d",&mb[i][j]);
        }
    }
    int m;
    scanf("%d",&m);
    int da[m][2];
    for(int i=0;i<m;i++){
        for(int j=0;j<2;j++){
            scanf("%d",&da[i][j]);
        }
    }
    int bcnt[m];
    for(int i=0;i<m;i++){
        bcnt[i]=0;
    }
    int isbought=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if((mb[i][0]>=da[j][0])and(mb[i][1]<=da[j][1])){
                isbought=1;
                bcnt[j]++;
            }
        }
    }
    if(isbought==1){
        int max=0;
        for(int i=0;i<m;i++){
            if(max<bcnt[i]){
                max=bcnt[i];
            }
        }
        for(int i=0;i<m;i++){
            if(bcnt[i]==max){
                printf("%d",i+1);
                printf("%s","\n");
            }
        }
    }else{
        printf("%d",0);
    }
}
0