結果
問題 | No.647 明太子 |
ユーザー |
![]() |
提出日時 | 2018-05-30 18:13:44 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 39 ms / 4,500 ms |
コード長 | 984 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 24,320 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 08:19:50 |
合計ジャッジ時間 | 1,564 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:8:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&mb[i][j]); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d",&m); | ~~~~~^~~~~~~~~ main.cpp:16:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d",&da[i][j]); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#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); } }