結果
問題 |
No.647 明太子
|
ユーザー |
![]() |
提出日時 | 2018-02-12 17:55:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 624 ms / 4,500 ms |
コード長 | 798 bytes |
コンパイル時間 | 2,918 ms |
コンパイル使用メモリ | 87,496 KB |
実行使用メモリ | 48,636 KB |
最終ジャッジ日時 | 2024-06-27 02:42:07 |
合計ジャッジ時間 | 10,276 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
import java.util.*; import java.util.stream.*; class A{ static class Person{ int cost,hot; Person(int c,int h){ this.cost=c; this.hot=h; } boolean isMatch(int v,int h) { return cost>=v&&hot<=h; } } public static void main(String[]$){ Scanner s=new Scanner(System.in); int n=s.nextInt(); Person[]p=IntStream.range(0,n) .mapToObj(i->new Person(s.nextInt(),s.nextInt())) .toArray(Person[]::new); int m=s.nextInt(); ArrayList<Integer>l=new ArrayList<>(); l.add(0); long max=0; for(int i=1;i<=m;++i) { int x=s.nextInt(),y=s.nextInt(); long v=Arrays.stream(p) .filter(o->o.isMatch(x,y)) .count(); if(max<v) { max=v; l.clear(); l.add(i); }else if(v>0&&max==v) { l.add(i); } } l.forEach(System.out::println); } }