結果

問題 No.674 n連勤
ユーザー gaming1106gaming1106
提出日時 2018-07-13 01:40:54
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 970 bytes
コンパイル時間 2,113 ms
コンパイル使用メモリ 78,080 KB
実行使用メモリ 58,548 KB
最終ジャッジ日時 2024-04-15 07:23:29
合計ジャッジ時間 6,007 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
54,116 KB
testcase_01 AC 111 ms
54,108 KB
testcase_02 RE -
testcase_03 AC 126 ms
54,104 KB
testcase_04 AC 124 ms
53,884 KB
testcase_05 WA -
testcase_06 AC 127 ms
54,092 KB
testcase_07 WA -
testcase_08 AC 125 ms
54,152 KB
testcase_09 AC 126 ms
54,116 KB
testcase_10 AC 111 ms
52,828 KB
testcase_11 WA -
testcase_12 AC 358 ms
58,548 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);
    int D,Q,A,B,x1=0,x2=0,k=0;
    boolean flag=false;
    D=Integer.parseInt(scan.next());
    Q=Integer.parseInt(scan.next());
    int[] task=new int[D];
    for(int i=0;i<task.length;i++){
      task[i]=0;
    }

    while(k<Q){
      x1=0;
      A=Integer.parseInt(scan.next());
      B=Integer.parseInt(scan.next());
      for(int i=A;i<=B;i++){
        task[i]++;
      }
      for(int i=0;i<task.length;i++){
        if(task[i]>0){
          if(B==task.length-1 && i==task.length-1){
            x1++;
            x2=Math.max(x1,x2);
            flag=false;
          }else{
            x1++;
            flag=true;
          }
        }else if(flag){
          x2=Math.max(x1,x2);
          flag=false;
          x1=0;
        }
      }
      System.out.println(x2);
      k++;
    }
  }
}
0