Submission #524201


Source Code Expand

Copy
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int m = scan.nextInt();
		
		int[] s = new int[m];
		int[] t = new int[m];
		int[] array = new int[n];
		for(int i = 0 ; i < m ; i++){
			s[i] = scan.nextInt() -1;
			t[i] = scan.nextInt();
			for(int j = s[i] ; j < t[i] ; j++){
				array[j]++;
			}
		}
		int[] flag = new int[m];
		int cnt = 0;
		for(int i = 0 ; i < m ; i++){
			int c = 0;
			for(int j = s[i] ; j < t[i] ; j++){
				if(array[j] == 1){
					c = 0;
					break;
				}else {
					c = 1;
				}
			}
			if(c == 1){
				flag[i] = 1;
			}
			
			cnt += c;
		}
		System.out.println(cnt);
		for(int i = 0 ; i < m ; i++){
			if(flag[i] == 1){
				System.out.println(i + 1);
			}
		}
	}
}

Submission Info

Submission Time
Task B - ドキドキデート大作戦高橋君
User kisinnkisi
Language Java (OpenJDK 1.7.0)
Score 30
Code Size 854 Byte
Status
Exec Time 2045 ms
Memory 41308 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
Subtask1 30 / 30 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 0 / 70 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 430 ms 23944 KB
subtask0_sample_02.txt 422 ms 23840 KB
subtask0_sample_03.txt 422 ms 23804 KB
subtask1_01.txt 1000 ms 40716 KB
subtask1_02.txt 1975 ms 40816 KB
subtask1_03.txt 1012 ms 40512 KB
subtask1_04.txt 1757 ms 41176 KB
subtask1_05.txt 1757 ms 41308 KB
subtask1_06.txt 428 ms 23928 KB
subtask1_07.txt 425 ms 23920 KB
subtask1_08.txt 417 ms 23820 KB
subtask1_09.txt 414 ms 23856 KB
subtask2_01.txt 2040 ms 35952 KB
subtask2_02.txt 2039 ms 36056 KB
subtask2_03.txt 478 ms 25652 KB
subtask2_04.txt 466 ms 25672 KB
subtask2_05.txt 473 ms 25532 KB
subtask2_06.txt 463 ms 25688 KB
subtask2_07.txt 460 ms 25472 KB
subtask2_08.txt 2045 ms 39800 KB