結果

問題 No.647 明太子
ユーザー PraiPrai
提出日時 2018-03-19 03:21:08
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 37 ms / 4,500 ms
コード長 712 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 29,832 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 09:42:02
合計ジャッジ時間 1,346 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>

int  main(void){
 
  int N, M, i, j;
  scanf("%d", &N);

  int Ai[N], Bi[N];
  for(i=0;i<N;i++){
    scanf("%d %d", &Ai[i], &Bi[i]);
  }

  scanf("%d", &M);

  int Xi[M], Yi[M];
  for(i=0;i<M;i++){
    scanf("%d %d", &Xi[i], &Yi[i]);
  }

  int sum[M];
  for(j=0;j<M;j++)sum[j] = 0;


  for(i=0;i<N;i++){
    for(j=0;j<M;j++){
      if(Ai[i] >= Xi[j] && Bi[i] <= Yi[j]){
	sum[j]++;
      }
    }
  }

  int max = 0;
  
  for(j=0;j<M;j++){
    if(max < sum[j]){
      max = sum[j];
    }
  }

  if(max == 0){
    printf("0\n");
  }else {
    for(i=0;i<M;i++){
      if(sum[i] == max)
	printf("%d\n", i+1);
    }
  }
  
/*
3
6 4		0		
5 2		1
2 5		2
2
4 3		0		1		1
5 4		1		1	1	2
*/



	return 0;
}
0