Submission #524714


Source Code Expand

Copy
#include <stdio.h>

#define N 300000
#define M 100000

int main()
{
  int n,m,i,j;
  int from[M];
  int to[M];
  int room[N];
  int flag;
  int count = 0;

  scanf("%d %d", &n, &m);
  for(i=0;i<n;i++){
    room[i]=0;
  }
  
  for(i=0;i<m;i++){
    scanf("%d %d", &from[i], &to[i]);
    for(j=from[i]-1;j<to[i];j++){
      room[j]++;
    }
  }
  for(i=0;i<m;i++){
    flag = 1;
    for(j=from[i]-1;j<to[i];j++){
      if(room[j]<=1){
        flag = 0;
        break;
      }
    }
    if(flag > 0){
      count++;
    }
  }
  
  printf("%d\n", count);
  
  for(i=0;i<m;i++){
    flag = 1;
    for(j=from[i]-1;j<to[i];j++){
      if(room[j]<=1){
        flag = 0;
        break;
      }
    }
    if(flag > 0){
      printf("%d\n", i+1);
    }
  }
  
  return 0;
}

Submission Info

Submission Time
Task A - スペース高橋君
User inari
Language C (GCC 4.9.2)
Score 0
Code Size 816 Byte
Status
Exec Time 26 ms
Memory 800 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:15:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &n, &m);
   ^
./Main.c:21:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &from[i], &to[i]);
     ^

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 example_0.txt, example_1.txt, example_2.txt
All 0 / 100 corner_0.txt, corner_1.txt, corner_2.txt, example_0.txt, example_1.txt, example_2.txt, maxrand_0.txt, maxrand_1.txt, maxrand_2.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt
Case Name Status Exec Time Memory
corner_0.txt 25 ms 788 KB
corner_1.txt 23 ms 796 KB
corner_2.txt 23 ms 668 KB
example_0.txt 24 ms 792 KB
example_1.txt 23 ms 800 KB
example_2.txt 25 ms 792 KB
maxrand_0.txt 24 ms 696 KB
maxrand_1.txt 24 ms 672 KB
maxrand_2.txt 24 ms 696 KB
random_0.txt 26 ms 700 KB
random_1.txt 25 ms 696 KB
random_2.txt 23 ms 788 KB
random_3.txt 26 ms 692 KB
random_4.txt 25 ms 792 KB