結果
問題 |
No.674 n連勤
|
ユーザー |
![]() |
提出日時 | 2018-07-13 01:38:23 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,005 bytes |
コンパイル時間 | 2,528 ms |
コンパイル使用メモリ | 77,264 KB |
実行使用メモリ | 56,048 KB |
最終ジャッジ日時 | 2024-10-04 22:10:15 |
合計ジャッジ時間 | 8,497 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 RE * 1 |
other | WA * 8 TLE * 1 -- * 8 |
ソースコード
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++; } } }