Submission #524167


Source Code Expand

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

class Program
{
    static void Main(string[] args)
    {
        int[] n = io.r<int>(' ');
        int[][] st = io.r<int>(n[1], ' ');
        List<int> ret = new List<int>();
        int[] a = new int[n[0]];
        int memocnt = 0;
        int num = 0;
        
        for (int k = 0; k < n[1]; k++)
        {
            bool f = true;
            if (k > 0)
            {
                int s = st[k - 1][0];
                int t = st[k - 1][1];
                for (int j = s; j <= t; j++)
                {
                    if (a[j - 1] == 0) { memocnt--; }
                    a[j - 1]++;
                }
                s = st[k][0];
                t = st[k][1];
                for (int j = s; j <= t; j++)
                {
                    a[j - 1]--;
                    if (a[j - 1] == 0) { memocnt++; }
                }
                if (memocnt != 0) { f = false; }
            }
            else
            {
                int cnt = st.Count();
                for (int i = 0; i < cnt; i++)
                {
                    if (k != i)
                    {
                        int s = st[i][0];
                        int t = st[i][1];
                        for (int j = s; j <= t; j++)
                        {
                            a[j - 1]++;
                        }
                    }
                }
                cnt = a.Count();
                for (int i = 0; i < cnt; i++)
                {
                    if (a[i] == 0) { f = false; memocnt++; }
                }
            }
            if (f) { ret.Add(k + 1); num++; } 
        }
        io.w(num);
        foreach (int buf in ret)
        {
            io.w(buf);
        }
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Submission Info

Submission Time
Task B - ドキドキデート大作戦高橋君
User nokonoko
Language C# (Mono 3.2.1.0)
Score 30
Code Size 3244 Byte
Status TLE
Exec Time 2037 ms
Memory 20852 KiB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 30 / 30 0 / 70
Status
AC × 3
AC × 12
AC × 17
TLE × 3
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
Subtask1 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 145 ms 9940 KiB
subtask0_sample_02.txt AC 145 ms 9944 KiB
subtask0_sample_03.txt AC 145 ms 9944 KiB
subtask1_01.txt AC 390 ms 19472 KiB
subtask1_02.txt AC 488 ms 20852 KiB
subtask1_03.txt AC 381 ms 19120 KiB
subtask1_04.txt AC 413 ms 19756 KiB
subtask1_05.txt AC 412 ms 19752 KiB
subtask1_06.txt AC 146 ms 9912 KiB
subtask1_07.txt AC 146 ms 9860 KiB
subtask1_08.txt AC 147 ms 9856 KiB
subtask1_09.txt AC 148 ms 9848 KiB
subtask2_01.txt TLE 2037 ms 19660 KiB
subtask2_02.txt TLE 2036 ms 19848 KiB
subtask2_03.txt AC 212 ms 9936 KiB
subtask2_04.txt AC 177 ms 9984 KiB
subtask2_05.txt AC 148 ms 9988 KiB
subtask2_06.txt AC 144 ms 9908 KiB
subtask2_07.txt AC 144 ms 9940 KiB
subtask2_08.txt TLE 2036 ms 19468 KiB