Submission #2853561


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;
                }
              ans = Math.max(ans, count);
            }
/*            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 1174 Byte
Status WA
Exec Time 2109 ms
Memory 27864 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 25800 KB
02.txt TLE 2109 ms 22740 KB
03.txt TLE 2109 ms 23632 KB
04.txt TLE 2105 ms 25060 KB
05.txt TLE 2109 ms 22996 KB
06.txt TLE 2109 ms 27732 KB
07.txt TLE 2105 ms 23124 KB
08.txt TLE 2109 ms 26164 KB
09.txt TLE 2105 ms 24004 KB
10.txt TLE 2105 ms 24032 KB
11.txt TLE 2109 ms 24148 KB
12.txt TLE 2105 ms 24976 KB
13.txt TLE 2105 ms 23528 KB
14.txt TLE 2109 ms 23756 KB
15.txt TLE 2109 ms 24048 KB
16.txt TLE 2109 ms 25512 KB
17.txt TLE 2109 ms 22848 KB
18.txt TLE 2109 ms 24876 KB
19.txt TLE 2109 ms 23756 KB
20.txt TLE 2105 ms 27864 KB
21.txt AC 90 ms 19924 KB
22.txt AC 90 ms 19540 KB
23.txt AC 90 ms 18644 KB
24.txt WA 88 ms 18644 KB
25.txt WA 90 ms 20564 KB
26.txt AC 88 ms 19924 KB
27.txt WA 89 ms 19668 KB
s1.txt WA 88 ms 19796 KB
s2.txt WA 92 ms 19540 KB
s3.txt WA 90 ms 19028 KB