Submission #2853522


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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
WA × 3
AC × 3
WA × 7
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 25172 KB
02.txt TLE 2105 ms 23764 KB
03.txt TLE 2104 ms 23916 KB
04.txt TLE 2109 ms 22728 KB
05.txt TLE 2108 ms 25812 KB
06.txt TLE 2105 ms 23760 KB
07.txt TLE 2108 ms 23592 KB
08.txt TLE 2109 ms 24404 KB
09.txt TLE 2108 ms 25172 KB
10.txt TLE 2109 ms 26244 KB
11.txt TLE 2109 ms 23872 KB
12.txt TLE 2108 ms 25660 KB
13.txt TLE 2105 ms 25044 KB
14.txt TLE 2104 ms 25992 KB
15.txt TLE 2108 ms 28884 KB
16.txt TLE 2109 ms 24476 KB
17.txt TLE 2108 ms 25720 KB
18.txt TLE 2108 ms 22804 KB
19.txt TLE 2108 ms 25012 KB
20.txt TLE 2109 ms 23508 KB
21.txt AC 88 ms 18900 KB
22.txt AC 88 ms 21588 KB
23.txt AC 87 ms 19796 KB
24.txt WA 88 ms 18512 KB
25.txt WA 88 ms 19668 KB
26.txt WA 88 ms 20688 KB
27.txt WA 89 ms 20688 KB
s1.txt WA 91 ms 21332 KB
s2.txt WA 88 ms 21844 KB
s3.txt WA 91 ms 19924 KB