Submission #69304991


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

#pragma warning disable CS8603, CS8604, CS8602


namespace ProblemB
{
    internal class TEST
    {
        public static void Main()
        {
            Sol mySol = new Sol();
            mySol.Solve();
        }
    }

    internal class Sol
    {
        public void Solve()
        {
            int[] posa = new int[N + 1];
            int idx = 0;
            posa[idx] = 1;
            for(int i=0;i<N;i++){
                if(L[i] == 0){
                    idx++;
                    posa[idx] = 1;
                }else{
                    break;
                }
            }
            int[] posb = new int[N + 1];
            idx = N;
            posb[idx] = 1;
			for (int i = N-1; i >=0; i--) {
				if (L[i] == 0) {
                    idx--;
                    posb[idx] = 1;
                } else {
                    break;
				}
			}

            int cnt = 0;
            for(int i=0;i<=N;i++){
                if(posa[i] == 0 && posb[i] == 0){
                    cnt++;
				}
			}
            Console.WriteLine(cnt);
		}
        int N;
        int[] L;
        public Sol()
        {
            N = ri();
            L = ria();
        }

        static String rs() { return Console.ReadLine(); }
        static int ri() { return int.Parse(Console.ReadLine()); }
        static long rl() { return long.Parse(Console.ReadLine()); }
        static double rd() { return double.Parse(Console.ReadLine()); }
        static String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static T[] mka<T>(int n, T ini) { T[] ret = new T[n]; for (int i = 0; i < n; i++) ret[i] = ini; return ret; }
        static T[][] mka<T>(int n, int m, T ini) { T[][] ret = new T[n][]; for (int i = 0; i < n; i++) ret[i] = mka(m, ini); return ret; }
        static T[][][] mka<T>(int n, int m, int l, T ini) { T[][][] ret = new T[n][][]; for (int i = 0; i < n; i++) ret[i] = mka(m, l, ini); return ret; }
        static T[][][][] mka<T>(int n, int m, int l, int k, T ini) { T[][][][] ret = new T[n][][][]; for (int i = 0; i < n; i++) ret[i] = mka(m, l, k, ini); return ret; }
        static T[] mka<T>(int n) where T : new() { T[] ret = new T[n]; for (int i = 0; i < n; i++) ret[i] = new T(); return ret; }
        static T[][] mka<T>(int n, int m) where T : new() { T[][] ret = new T[n][]; for (int i = 0; i < n; i++) ret[i] = mka<T>(m); return ret; }
        static T[][][] mka<T>(int n, int m, int l) where T : new() { T[][][] ret = new T[n][][]; for (int i = 0; i < n; i++) ret[i] = mka<T>(m, l); return ret; }
        static T[][][][] mka<T>(int n, int m, int l, int k) where T : new() { T[][][][] ret = new T[n][][][]; for (int i = 0; i < n; i++) ret[i] = mka<T>(m, l, k); return ret; }

    }

}

Submission Info

Submission Time
Task B - Locked Rooms
User kuuso
Language C# 11.0 (.NET 7.0.7)
Score 200
Code Size 3294 Byte
Status AC
Exec Time 46 ms
Memory 24924 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 27
Set Name Test Cases
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt
Case Name Status Exec Time Memory
sample00.txt AC 46 ms 24532 KiB
sample01.txt AC 40 ms 24656 KiB
sample02.txt AC 33 ms 24796 KiB
testcase00.txt AC 36 ms 24416 KiB
testcase01.txt AC 45 ms 24508 KiB
testcase02.txt AC 35 ms 24520 KiB
testcase03.txt AC 36 ms 24512 KiB
testcase04.txt AC 36 ms 24652 KiB
testcase05.txt AC 36 ms 24804 KiB
testcase06.txt AC 44 ms 24468 KiB
testcase07.txt AC 36 ms 24924 KiB
testcase08.txt AC 36 ms 24764 KiB
testcase09.txt AC 37 ms 24404 KiB
testcase10.txt AC 34 ms 24564 KiB
testcase11.txt AC 37 ms 24468 KiB
testcase12.txt AC 43 ms 24644 KiB
testcase13.txt AC 34 ms 24672 KiB
testcase14.txt AC 39 ms 24788 KiB
testcase15.txt AC 40 ms 24636 KiB
testcase16.txt AC 40 ms 24472 KiB
testcase17.txt AC 44 ms 24472 KiB
testcase18.txt AC 41 ms 24636 KiB
testcase19.txt AC 33 ms 24472 KiB
testcase20.txt AC 35 ms 24476 KiB
testcase21.txt AC 45 ms 24404 KiB
testcase22.txt AC 33 ms 24656 KiB
testcase23.txt AC 36 ms 24796 KiB