Submission #2853510
Source Code Expand
import java.util.*; class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int[] a = new int[s.length()]; for(int i = 0; i < a.length; i++){ if(s.charAt(i) == '0'){ a[i] = 0; } else{ a[i] = 1; } } int ans = 1; for(int i = 1; i < a.length - 1; i++){ int count = 0; for(int j = 0; j < a.length - i + 1; j++){ if(a[j] == 1){ count++; for(int l = 1; l < i; l++){ a[j + l] = (a[i] == 0) ? 1 : 0; } } } int key = 0; for(int k = 0; k < i; k++){ key += a[a.length - 1 - k]; } if(key == 0){ ans = Math.max(ans, count); } } System.out.println(ans); } }
Submission Info
Submission Time | |
---|---|
Task | D - Wide Flip |
User | tonq |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1054 Byte |
Status | WA |
Exec Time | 2112 ms |
Memory | 26160 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | TLE | 2109 ms | 23640 KB |
02.txt | TLE | 2105 ms | 25504 KB |
03.txt | TLE | 2109 ms | 23912 KB |
04.txt | TLE | 2108 ms | 24044 KB |
05.txt | TLE | 2108 ms | 26068 KB |
06.txt | TLE | 2108 ms | 22880 KB |
07.txt | TLE | 2108 ms | 23532 KB |
08.txt | TLE | 2105 ms | 23132 KB |
09.txt | TLE | 2112 ms | 22996 KB |
10.txt | TLE | 2108 ms | 24916 KB |
11.txt | TLE | 2109 ms | 26080 KB |
12.txt | TLE | 2108 ms | 26160 KB |
13.txt | TLE | 2108 ms | 24960 KB |
14.txt | TLE | 2108 ms | 21968 KB |
15.txt | TLE | 2104 ms | 23980 KB |
16.txt | TLE | 2105 ms | 23472 KB |
17.txt | TLE | 2108 ms | 25228 KB |
18.txt | TLE | 2108 ms | 24272 KB |
19.txt | TLE | 2108 ms | 23960 KB |
20.txt | TLE | 2108 ms | 24428 KB |
21.txt | AC | 89 ms | 18644 KB |
22.txt | AC | 88 ms | 19924 KB |
23.txt | AC | 88 ms | 21716 KB |
24.txt | WA | 90 ms | 19412 KB |
25.txt | WA | 90 ms | 18644 KB |
26.txt | WA | 88 ms | 18512 KB |
27.txt | AC | 88 ms | 21972 KB |
s1.txt | WA | 90 ms | 23764 KB |
s2.txt | WA | 89 ms | 19540 KB |
s3.txt | WA | 90 ms | 19540 KB |