Submission #1399738
Source Code Expand
#include <stdio.h> int main() { int N,X,M; scanf ("%d %d %d",&N,&X,&M); int L[10],R[10],S[10]; for (int i=0;i<M;i++) scanf ("%d %d %d",&L[i],&R[i],&S[i]); int u = 1; for (int i=0;i<N;i++) u *= (X+1); int mx = 0; for (int i=0;i<u;i++){ int A[7],t=i; for (int j=N;j>=1;j--){ A[j] = t % (X+1); t /= X+1; } for (int j=1;j<=N;j++) A[j] += A[j-1]; bool g = 1; for (int j=0;j<M;j++){ if (A[R[j]] - A[L[j]-1] != S[j]) g = 0; } if (g){ if (mx < A[N]) mx = A[N]; } } for (int i=0;i<u;i++){ int A[7],t=i; for (int j=N;j>=1;j--){ A[j] = t % (X+1); t /= X+1; } for (int j=1;j<=N;j++) A[j] += A[j-1]; bool g = 1; for (int j=0;j<M;j++){ if (A[R[j]] - A[L[j]-1] != S[j]) g = 0; } if (g && A[N] == mx){ for (int j=1;j<=N;j++) printf ("%d%c",A[j]-A[j-1],j<N?' ':'\n'); return 0; } } puts("-1"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - ライオン |
User | august14 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 924 Byte |
Status | AC |
Exec Time | 238 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:6:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf ("%d %d %d",&N,&X,&M); ^ ./Main.cpp:9:60: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for (int i=0;i<M;i++) scanf ("%d %d %d",&L[i],&R[i],&S[i]); ^
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 200 / 200 | ||
Status |
|
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 | 120 ms | 128 KB |
00_test_01.txt | AC | 1 ms | 128 KB |
00_test_02.txt | AC | 1 ms | 128 KB |
00_test_03.txt | AC | 1 ms | 128 KB |
00_test_04.txt | AC | 74 ms | 128 KB |
00_test_05.txt | AC | 238 ms | 128 KB |
10_random_00.txt | AC | 1 ms | 128 KB |
10_random_01.txt | AC | 1 ms | 128 KB |
10_random_02.txt | AC | 1 ms | 128 KB |
10_random_03.txt | AC | 1 ms | 128 KB |
10_random_04.txt | AC | 1 ms | 128 KB |
10_random_05.txt | AC | 1 ms | 128 KB |
10_random_06.txt | AC | 0 ms | 128 KB |
10_random_07.txt | AC | 1 ms | 128 KB |
10_random_08.txt | AC | 1 ms | 128 KB |
10_random_09.txt | AC | 4 ms | 128 KB |
10_small_10.txt | AC | 1 ms | 128 KB |
10_small_11.txt | AC | 1 ms | 128 KB |
10_small_12.txt | AC | 1 ms | 128 KB |
10_small_13.txt | AC | 1 ms | 128 KB |
10_small_14.txt | AC | 1 ms | 128 KB |
10_small_15.txt | AC | 1 ms | 128 KB |
10_small_16.txt | AC | 1 ms | 128 KB |
10_small_17.txt | AC | 0 ms | 128 KB |
10_small_18.txt | AC | 1 ms | 128 KB |
10_small_19.txt | AC | 1 ms | 128 KB |
10_test_00.txt | AC | 1 ms | 128 KB |
10_test_01.txt | AC | 0 ms | 128 KB |
10_test_02.txt | AC | 1 ms | 128 KB |
10_test_03.txt | AC | 1 ms | 128 KB |
10_test_04.txt | AC | 1 ms | 128 KB |
10_test_05.txt | AC | 0 ms | 128 KB |
10_test_06.txt | AC | 1 ms | 128 KB |
10_test_07.txt | AC | 1 ms | 128 KB |
10_test_08.txt | AC | 0 ms | 128 KB |
10_test_09.txt | AC | 0 ms | 128 KB |
10_test_10.txt | AC | 1 ms | 128 KB |
10_test_11.txt | AC | 7 ms | 128 KB |
10_test_12.txt | AC | 1 ms | 128 KB |
10_test_13.txt | AC | 1 ms | 128 KB |
10_test_14.txt | AC | 0 ms | 128 KB |
10_test_15.txt | AC | 8 ms | 128 KB |
10_test_16.txt | AC | 1 ms | 128 KB |
10_test_17.txt | AC | 1 ms | 128 KB |
10_test_18.txt | AC | 1 ms | 128 KB |
10_test_19.txt | AC | 1 ms | 128 KB |
10_test_20.txt | AC | 144 ms | 128 KB |
10_test_21.txt | AC | 119 ms | 128 KB |
10_test_22.txt | AC | 119 ms | 128 KB |
10_test_23.txt | AC | 118 ms | 128 KB |
10_test_24.txt | AC | 151 ms | 128 KB |
10_test_25.txt | AC | 151 ms | 128 KB |
10_test_26.txt | AC | 151 ms | 128 KB |
10_test_27.txt | AC | 144 ms | 128 KB |
10_test_28.txt | AC | 118 ms | 128 KB |
10_test_29.txt | AC | 150 ms | 128 KB |
10_test_30.txt | AC | 61 ms | 128 KB |
10_test_31.txt | AC | 122 ms | 128 KB |
10_test_32.txt | AC | 168 ms | 128 KB |
10_test_33.txt | AC | 222 ms | 128 KB |
10_test_34.txt | AC | 99 ms | 128 KB |
10_test_35.txt | AC | 168 ms | 128 KB |
10_test_36.txt | AC | 193 ms | 128 KB |
10_test_37.txt | AC | 78 ms | 128 KB |
10_test_38.txt | AC | 142 ms | 128 KB |
10_test_39.txt | AC | 200 ms | 128 KB |
20_random_20.txt | AC | 137 ms | 128 KB |
20_random_21.txt | AC | 230 ms | 128 KB |
20_random_22.txt | AC | 197 ms | 128 KB |
20_random_23.txt | AC | 233 ms | 128 KB |
20_random_24.txt | AC | 125 ms | 128 KB |
20_random_25.txt | AC | 230 ms | 128 KB |
20_random_26.txt | AC | 136 ms | 128 KB |
20_random_27.txt | AC | 167 ms | 128 KB |
20_random_28.txt | AC | 230 ms | 128 KB |
20_random_29.txt | AC | 231 ms | 128 KB |