Submission #1687899


Source Code Expand

import java.util.*;

class Main{

   public static void main(String[] args){

       Scanner sc = new Scanner(System.in);
      
       int N = sc.nextInt();       
       int M = sc.nextInt();
       
       int X = sc.nextInt();
       int Y = sc.nextInt();
       
       int a[] = new int[N];
       int b[] = new int[M];
       
       for(int i = 0;i < N;i++){
          a[i] = sc.nextInt();
       }
       
       for(int i = 0;i < M;i++){
           b[i] = sc.nextInt();           
       }
       
       int time = 0;
       int aindex = 0;
       int bindex = 0;
       
       boolean aflag = false;
       boolean bflag = false;
       
       int ans = 0;
       
       while(true){
           time = a[aindex] + X;
           bindex = lower_bound(b,time);
           
           if(bindex >= M){
               break;
           }
           
           time = b[bindex] + Y;
           
           aindex = lower_bound(a,time);
           
           ans++;
           
           if(aindex >= N){
               break;
           }
           
       }
       
       System.out.println(ans);
   }   

   static int lower_bound(int a[],int time){
       
       int l = 0;
       int r = a.length-1;
       
       while(l <= r){
           int mid = (l+r)/2;
           
           if(a[mid] >= time){
               r = mid - 1;
           }else{
               l = mid + 1;
           }                      
       }
       
       return l;
       
       
   }

}
        
        
        
        

Submission Info

Submission Time
Task A - 勝率計算
User suesue
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1605 Byte
Status RE
Exec Time 101 ms
Memory 23636 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
RE × 3
RE × 33
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
All 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
Case Name Status Exec Time Memory
0.txt RE 96 ms 21588 KB
1.txt RE 93 ms 21844 KB
10.txt RE 95 ms 23636 KB
11.txt RE 95 ms 23124 KB
12.txt RE 94 ms 19796 KB
13.txt RE 99 ms 21588 KB
14.txt RE 95 ms 21332 KB
15.txt RE 98 ms 16976 KB
16.txt RE 94 ms 21844 KB
17.txt RE 94 ms 21844 KB
18.txt RE 97 ms 20820 KB
19.txt RE 101 ms 21332 KB
2.txt RE 92 ms 19924 KB
20.txt RE 94 ms 21716 KB
21.txt RE 94 ms 21844 KB
22.txt RE 93 ms 20688 KB
23.txt RE 96 ms 19284 KB
24.txt RE 96 ms 20564 KB
25.txt RE 94 ms 23124 KB
26.txt RE 98 ms 20564 KB
27.txt RE 93 ms 20052 KB
28.txt RE 96 ms 21332 KB
29.txt RE 93 ms 21716 KB
3.txt RE 94 ms 19412 KB
4.txt RE 96 ms 18004 KB
5.txt RE 94 ms 21716 KB
6.txt RE 95 ms 19028 KB
7.txt RE 93 ms 21716 KB
8.txt RE 92 ms 21716 KB
9.txt RE 93 ms 19796 KB
subtask0_sample_01.txt RE 97 ms 19284 KB
subtask0_sample_02.txt RE 97 ms 21844 KB
subtask0_sample_03.txt RE 96 ms 18644 KB