Submission #2853556


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 = 2; i <= a.length; i++){
            int count = 0;
            for(int j = 0; j < a.length - i + 1; j++){
                if(a[j] == 1){
                    count++;
                    for(int l = 0; l < i; l++){
                         a[j + l] = (a[j + l] + 1 ) % 2;
                    }
                }
            }
            int key = 0;
            for(int k = 0; k < i; k++){
                if(a[a.length - 1 - k] == 1){
                    key = 1;
                    break;
                }
            }
            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 1127 Byte
Status WA
Exec Time 2109 ms
Memory 26492 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
WA × 3
AC × 4
WA × 6
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 2109 ms 22868 KB
02.txt TLE 2108 ms 23252 KB
03.txt TLE 2108 ms 24784 KB
04.txt TLE 2108 ms 23044 KB
05.txt TLE 2105 ms 23868 KB
06.txt TLE 2108 ms 24656 KB
07.txt TLE 2105 ms 23100 KB
08.txt TLE 2108 ms 22868 KB
09.txt TLE 2108 ms 26076 KB
10.txt TLE 2108 ms 23500 KB
11.txt TLE 2108 ms 24164 KB
12.txt TLE 2108 ms 23252 KB
13.txt TLE 2107 ms 23996 KB
14.txt TLE 2108 ms 24404 KB
15.txt TLE 2109 ms 26492 KB
16.txt TLE 2108 ms 25792 KB
17.txt TLE 2109 ms 23536 KB
18.txt TLE 2108 ms 24884 KB
19.txt TLE 2108 ms 23220 KB
20.txt TLE 2108 ms 25132 KB
21.txt AC 89 ms 19796 KB
22.txt AC 90 ms 19540 KB
23.txt AC 90 ms 19796 KB
24.txt WA 89 ms 19156 KB
25.txt WA 91 ms 21712 KB
26.txt AC 89 ms 20948 KB
27.txt WA 94 ms 19796 KB
s1.txt WA 89 ms 18900 KB
s2.txt WA 88 ms 19156 KB
s3.txt WA 89 ms 19284 KB