Submission #172475


Source Code Expand

Copy
#include <stdio.h>
#include <stdlib.h>

int i,j,k;

int SUM(int bottom,int roof,int count);
int C(int n,int r);
int F(int n);

int main(){
  int n;
  int a[2000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  
  int bottom,roof;
  int count;
  int s;
  int ans=1;

  int f=0;
  for(i=0;i<n;i++){
    count++;

    if(f==0 && a[i]==-1){
      bottom=a[i-1];
      f=1;
      count=0;
    }
    if(f==1 && a[i]!=-1){
      roof=a[i];
      f=0;
      printf("b:%d,r:%d,c:%d\n",bottom,roof,count);
      s=SUM(bottom,roof,count);
      ans*=s;
    }
  }

  printf("%d\n",ans);
  return 0;
}

int SUM(int bottom,int roof,int count){
  return C(roof-bottom+count,count);
}

int C(int n,int r){
  if(r<=0)return 1;
  return F(n)/(F(r)*F(n-r));
}

int F(int n){
  int f=n;
  if(n <= 0)return 1;

  while(--n)
    f *= n;
  return f;
}

Submission Info

Submission Time
Task C - タコヤ木
User Tanix
Language C (GCC 4.6.4)
Score 0
Code Size 910 Byte
Status WA
Exec Time 2035 ms
Memory 808 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:13:8: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
./Main.c:15:10: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 0 / 50 0 / 30 0 / 20
Status
WA × 2
TLE × 1
AC × 3
WA × 10
RE × 1
AC × 5
WA × 14
RE × 7
AC × 7
WA × 12
TLE × 1
RE × 16
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.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, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt
Subtask2 sample_01.txt, sample_02.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, subtask1_10.txt, subtask1_11.txt, subtask1_12.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, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Subtask3 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, subtask1_10.txt, subtask1_11.txt, subtask1_12.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, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt, subtask3_09.txt, subtask3_10.txt, subtask3_11.txt, subtask3_12.txt
Case Name Status Exec Time Memory
sample_01.txt WA 20 ms 800 KB
sample_02.txt WA 18 ms 696 KB
sample_03.txt TLE 2035 ms 796 KB
subtask1_01.txt AC 19 ms 708 KB
subtask1_02.txt AC 19 ms 800 KB
subtask1_03.txt WA 19 ms 804 KB
subtask1_04.txt WA 19 ms 676 KB
subtask1_05.txt WA 19 ms 804 KB
subtask1_06.txt WA 19 ms 804 KB
subtask1_07.txt RE 347 ms 796 KB
subtask1_08.txt AC 18 ms 800 KB
subtask1_09.txt WA 18 ms 800 KB
subtask1_10.txt WA 18 ms 700 KB
subtask1_11.txt WA 19 ms 792 KB
subtask1_12.txt WA 19 ms 800 KB
subtask2_01.txt AC 19 ms 796 KB
subtask2_02.txt RE 246 ms 796 KB
subtask2_03.txt RE 247 ms 696 KB
subtask2_04.txt WA 20 ms 800 KB
subtask2_05.txt WA 19 ms 656 KB
subtask2_06.txt RE 248 ms 668 KB
subtask2_07.txt RE 248 ms 672 KB
subtask2_08.txt AC 20 ms 800 KB
subtask2_09.txt RE 246 ms 804 KB
subtask2_10.txt RE 241 ms 668 KB
subtask2_11.txt WA 19 ms 800 KB
subtask2_12.txt WA 18 ms 692 KB
subtask3_01.txt AC 18 ms 696 KB
subtask3_02.txt RE 1009 ms 788 KB
subtask3_03.txt RE 276 ms 672 KB
subtask3_04.txt RE 253 ms 764 KB
subtask3_05.txt RE 242 ms 668 KB
subtask3_06.txt RE 240 ms 792 KB
subtask3_07.txt TLE 2030 ms 808 KB
subtask3_08.txt AC 22 ms 760 KB
subtask3_09.txt RE 249 ms 800 KB
subtask3_10.txt RE 259 ms 796 KB
subtask3_11.txt RE 267 ms 796 KB
subtask3_12.txt RE 248 ms 704 KB