Submission #2853481


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 = 0;
        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 2110 ms
Memory 26560 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
WA × 3
AC × 1
WA × 9
TLE × 20
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 2108 ms 24028 KB
02.txt TLE 2108 ms 26324 KB
03.txt TLE 2108 ms 23480 KB
04.txt TLE 2108 ms 24788 KB
05.txt TLE 2108 ms 25908 KB
06.txt TLE 2105 ms 21212 KB
07.txt TLE 2108 ms 25380 KB
08.txt TLE 2108 ms 25920 KB
09.txt TLE 2110 ms 23732 KB
10.txt TLE 2104 ms 24000 KB
11.txt TLE 2108 ms 24872 KB
12.txt TLE 2108 ms 23956 KB
13.txt TLE 2109 ms 26560 KB
14.txt TLE 2108 ms 24916 KB
15.txt TLE 2108 ms 22996 KB
16.txt TLE 2108 ms 24028 KB
17.txt TLE 2108 ms 23636 KB
18.txt TLE 2108 ms 25444 KB
19.txt TLE 2108 ms 24000 KB
20.txt TLE 2108 ms 24184 KB
21.txt WA 89 ms 21716 KB
22.txt WA 90 ms 19668 KB
23.txt WA 89 ms 19796 KB
24.txt WA 88 ms 18640 KB
25.txt WA 90 ms 21332 KB
26.txt WA 89 ms 19540 KB
27.txt AC 89 ms 19796 KB
s1.txt WA 88 ms 18512 KB
s2.txt WA 89 ms 19796 KB
s3.txt WA 88 ms 20052 KB