Submission #524458


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 0
Code Size 854 Byte
Status
Exec Time 2044 ms
Memory 41664 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 0 / 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 416 ms 23872 KB
subtask0_sample_02.txt 401 ms 23828 KB
subtask0_sample_03.txt 429 ms 23872 KB
subtask1_01.txt 1022 ms 41664 KB
subtask1_02.txt 2044 ms 40740 KB
subtask1_03.txt 998 ms 40576 KB
subtask1_04.txt 1658 ms 41012 KB
subtask1_05.txt 1748 ms 41284 KB
subtask1_06.txt 413 ms 23720 KB
subtask1_07.txt 403 ms 23832 KB
subtask1_08.txt 408 ms 23780 KB
subtask1_09.txt 409 ms 23824 KB
subtask2_01.txt 2041 ms 35928 KB
subtask2_02.txt 2043 ms 36180 KB
subtask2_03.txt 437 ms 25656 KB
subtask2_04.txt 439 ms 25644 KB
subtask2_05.txt 447 ms 25656 KB
subtask2_06.txt 452 ms 25624 KB
subtask2_07.txt 445 ms 25528 KB
subtask2_08.txt 2043 ms 39772 KB