Submission #922718


Source Code Expand

#include<stdio.h>
int n,m,o,a[20],b[20],c[20],d[20];
int f(int t){
  int i,j,s;
  if(t==n){
    for(i=0;i<o;i++){
      s=0;
      for(j=a[i]-1;j<b[i];j++)s+=d[j];
      if(s-c[i])return 0;
    }
    for(j=0;j<n-1;j++)printf("%d ",d[j]);
    printf("%d\n",d[j]);
    return 1;
  }
  for(i=m;i>-1;i--){
    d[t]=i;
    if(f(t+1))return 1;
  }
  return 0;
}
int main(){
  int i;
  scanf("%d %d %d",&n,&m,&o);
  for(i=0;i<o;i++)scanf("%d %d %d",&a[i],&b[i],&c[i]);
  if(f(0)==0)printf("-1\n");
  return 0;
}

Submission Info

Submission Time
Task B - ライオン
User yuiop
Language C (GCC 4.6.4)
Score 200
Code Size 532 Byte
Status AC
Exec Time 32 ms
Memory 804 KB

Compile Error

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

Judge Result

Set Name All
Score / Max Score 200 / 200
Status
AC × 76
Set Name Test Cases
All 00_test_00.txt, 00_test_01.txt, 00_test_02.txt, 00_test_03.txt, 00_test_04.txt, 00_test_05.txt, 10_random_00.txt, 10_random_01.txt, 10_random_02.txt, 10_random_03.txt, 10_random_04.txt, 10_random_05.txt, 10_random_06.txt, 10_random_07.txt, 10_random_08.txt, 10_random_09.txt, 10_small_10.txt, 10_small_11.txt, 10_small_12.txt, 10_small_13.txt, 10_small_14.txt, 10_small_15.txt, 10_small_16.txt, 10_small_17.txt, 10_small_18.txt, 10_small_19.txt, 10_test_00.txt, 10_test_01.txt, 10_test_02.txt, 10_test_03.txt, 10_test_04.txt, 10_test_05.txt, 10_test_06.txt, 10_test_07.txt, 10_test_08.txt, 10_test_09.txt, 10_test_10.txt, 10_test_11.txt, 10_test_12.txt, 10_test_13.txt, 10_test_14.txt, 10_test_15.txt, 10_test_16.txt, 10_test_17.txt, 10_test_18.txt, 10_test_19.txt, 10_test_20.txt, 10_test_21.txt, 10_test_22.txt, 10_test_23.txt, 10_test_24.txt, 10_test_25.txt, 10_test_26.txt, 10_test_27.txt, 10_test_28.txt, 10_test_29.txt, 10_test_30.txt, 10_test_31.txt, 10_test_32.txt, 10_test_33.txt, 10_test_34.txt, 10_test_35.txt, 10_test_36.txt, 10_test_37.txt, 10_test_38.txt, 10_test_39.txt, 20_random_20.txt, 20_random_21.txt, 20_random_22.txt, 20_random_23.txt, 20_random_24.txt, 20_random_25.txt, 20_random_26.txt, 20_random_27.txt, 20_random_28.txt, 20_random_29.txt
Case Name Status Exec Time Memory
00_test_00.txt AC 27 ms 672 KB
00_test_01.txt AC 18 ms 704 KB
00_test_02.txt AC 17 ms 668 KB
00_test_03.txt AC 17 ms 668 KB
00_test_04.txt AC 25 ms 696 KB
00_test_05.txt AC 17 ms 792 KB
10_random_00.txt AC 18 ms 668 KB
10_random_01.txt AC 18 ms 700 KB
10_random_02.txt AC 18 ms 668 KB
10_random_03.txt AC 16 ms 672 KB
10_random_04.txt AC 17 ms 796 KB
10_random_05.txt AC 15 ms 700 KB
10_random_06.txt AC 17 ms 708 KB
10_random_07.txt AC 16 ms 704 KB
10_random_08.txt AC 18 ms 796 KB
10_random_09.txt AC 19 ms 800 KB
10_small_10.txt AC 16 ms 696 KB
10_small_11.txt AC 16 ms 672 KB
10_small_12.txt AC 16 ms 696 KB
10_small_13.txt AC 20 ms 668 KB
10_small_14.txt AC 18 ms 800 KB
10_small_15.txt AC 18 ms 672 KB
10_small_16.txt AC 17 ms 700 KB
10_small_17.txt AC 17 ms 792 KB
10_small_18.txt AC 17 ms 708 KB
10_small_19.txt AC 17 ms 800 KB
10_test_00.txt AC 17 ms 796 KB
10_test_01.txt AC 17 ms 788 KB
10_test_02.txt AC 18 ms 700 KB
10_test_03.txt AC 17 ms 700 KB
10_test_04.txt AC 18 ms 668 KB
10_test_05.txt AC 16 ms 700 KB
10_test_06.txt AC 17 ms 792 KB
10_test_07.txt AC 17 ms 792 KB
10_test_08.txt AC 17 ms 668 KB
10_test_09.txt AC 17 ms 668 KB
10_test_10.txt AC 17 ms 796 KB
10_test_11.txt AC 18 ms 696 KB
10_test_12.txt AC 17 ms 672 KB
10_test_13.txt AC 18 ms 660 KB
10_test_14.txt AC 17 ms 672 KB
10_test_15.txt AC 18 ms 696 KB
10_test_16.txt AC 16 ms 704 KB
10_test_17.txt AC 17 ms 792 KB
10_test_18.txt AC 17 ms 780 KB
10_test_19.txt AC 18 ms 692 KB
10_test_20.txt AC 26 ms 796 KB
10_test_21.txt AC 27 ms 800 KB
10_test_22.txt AC 24 ms 800 KB
10_test_23.txt AC 26 ms 800 KB
10_test_24.txt AC 28 ms 692 KB
10_test_25.txt AC 27 ms 796 KB
10_test_26.txt AC 26 ms 696 KB
10_test_27.txt AC 27 ms 696 KB
10_test_28.txt AC 16 ms 792 KB
10_test_29.txt AC 26 ms 696 KB
10_test_30.txt AC 18 ms 700 KB
10_test_31.txt AC 17 ms 792 KB
10_test_32.txt AC 21 ms 788 KB
10_test_33.txt AC 18 ms 704 KB
10_test_34.txt AC 18 ms 800 KB
10_test_35.txt AC 21 ms 696 KB
10_test_36.txt AC 18 ms 704 KB
10_test_37.txt AC 20 ms 716 KB
10_test_38.txt AC 21 ms 668 KB
10_test_39.txt AC 17 ms 692 KB
20_random_20.txt AC 26 ms 796 KB
20_random_21.txt AC 29 ms 688 KB
20_random_22.txt AC 27 ms 672 KB
20_random_23.txt AC 28 ms 672 KB
20_random_24.txt AC 26 ms 692 KB
20_random_25.txt AC 29 ms 804 KB
20_random_26.txt AC 30 ms 788 KB
20_random_27.txt AC 28 ms 692 KB
20_random_28.txt AC 32 ms 668 KB
20_random_29.txt AC 26 ms 696 KB