Submission #2118745
Source Code Expand
#include <stdio.h> #include <stdlib.h> int main() { long long int K, *data, i, j, min_N = 2, max_N = 2, is_min_updated = 0, is_max_updated = 0; scanf("%lld", &K); data = (long long int *)malloc(sizeof(long long int) * (K + 1)); data[0] = 1; for (i = 1; i <= K; i++){ scanf("%lld", &data[i]); } for (i = K; i >= 1; i--){ for (j = 0; j < data[i]; j++){ if ((min_N + j) % data[i - 1] == 0){ min_N = min_N + j; is_min_updated = 1; break; } } for (j = data[i] - 1; j >= 0; j--) { if ((max_N + j) % data[i - 1] == 0){ max_N = max_N + j + data[i]; is_max_updated = 1; break; } } if (is_max_updated == 0 && is_min_updated ==0){ printf("-1\n"); free(data); return 0; }else if (is_max_updated == 0){ max_N = min_N; }else if (is_min_updated == 0){ min_N = max_N; } is_max_updated = is_min_updated = 0; } printf("%lld %lld\n", min_N, max_N); free(data); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Ice Rink Game |
User | ytsuyo9746 |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 1241 Byte |
Status | WA |
Exec Time | 2103 ms |
Memory | 896 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:8:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", &K); ^ ./Main.c:12:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", &data[i]); ^
Judge Result
Set Name | Sample | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | WA | 1 ms | 128 KB |
sample_02.txt | AC | 1 ms | 128 KB |
sample_03.txt | WA | 1 ms | 128 KB |
subtask_1_01.txt | WA | 1 ms | 128 KB |
subtask_1_02.txt | WA | 1 ms | 128 KB |
subtask_1_03.txt | WA | 1 ms | 128 KB |
subtask_1_04.txt | WA | 1 ms | 128 KB |
subtask_1_05.txt | WA | 1 ms | 128 KB |
subtask_1_06.txt | WA | 12 ms | 896 KB |
subtask_1_07.txt | TLE | 2103 ms | 896 KB |
subtask_1_08.txt | WA | 1 ms | 128 KB |
subtask_1_09.txt | WA | 1 ms | 128 KB |
subtask_1_10.txt | WA | 1 ms | 256 KB |
subtask_1_11.txt | WA | 12 ms | 896 KB |
subtask_1_12.txt | WA | 12 ms | 896 KB |
subtask_1_13.txt | WA | 14 ms | 896 KB |
subtask_1_14.txt | AC | 12 ms | 896 KB |
subtask_1_15.txt | AC | 12 ms | 896 KB |
subtask_1_16.txt | WA | 2 ms | 256 KB |
subtask_1_17.txt | WA | 11 ms | 896 KB |
subtask_1_18.txt | WA | 11 ms | 896 KB |
subtask_1_19.txt | AC | 10 ms | 896 KB |
subtask_1_20.txt | AC | 11 ms | 896 KB |
subtask_1_21.txt | AC | 11 ms | 896 KB |
subtask_1_22.txt | AC | 11 ms | 896 KB |
subtask_1_23.txt | TLE | 2103 ms | 128 KB |
subtask_1_24.txt | TLE | 2103 ms | 128 KB |
subtask_1_25.txt | TLE | 2103 ms | 896 KB |
subtask_1_26.txt | TLE | 2103 ms | 128 KB |
subtask_1_27.txt | TLE | 2103 ms | 896 KB |