結果

問題 No.674 n連勤
ユーザー gaming1106gaming1106
提出日時 2018-07-13 01:38:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,005 bytes
コンパイル時間 2,613 ms
コンパイル使用メモリ 78,160 KB
実行使用メモリ 56,680 KB
最終ジャッジ日時 2024-04-15 07:20:52
合計ジャッジ時間 7,656 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 RE -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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.print(task[i]);
      }
      System.out.println(x2);
      k++;
    }
  }
}
0