結果

問題 No.647 明太子
ユーザー toto6114toto6114
提出日時 2019-07-02 12:25:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 66,840 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-27 11:09:32
合計ジャッジ時間 1,699 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 36 ms
4,376 KB
testcase_15 AC 7 ms
4,380 KB
testcase_16 AC 3 ms
4,384 KB
testcase_17 AC 43 ms
4,380 KB
testcase_18 AC 46 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 29 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:19:27: 警告: ‘d’ may be used uninitialized [-Wmaybe-uninitialized]
   19 |   int M=*max_element(d,d+m);
      |                           ^
main.cpp:5:29: 備考: ‘d’ はここで宣言されています
    5 |   int n,m,a[10010],b[10010],d[1010],x,y;
      |                             ^

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int main() {
  int n,m,a[10010],b[10010],d[1010],x,y;
  cin >> n;
  for(int i=0; i<n; i++) {
      cin >> a[i] >> b[i];
  }
  cin >> m;
  for(int i=0; i<m; i++) {
      cin >> x >> y;
      for(int j=0; j<n; j++) {
          if(x<=a[j]&&y>=b[j]) {
              d[i]++;
          }
      }
  }
  int M=*max_element(d,d+m);
  for(int i=0; i<m; i++) {
      if(d[i]==M) {
          cout << i+1 << endl;
      }
  }
}
0