Submission #61005440
Source Code Expand
Copy
#include <stdio.h>#include <inttypes.h>int N;int64_t S;int A[212345];int main(void) {int i, start;int64_t all_sum = 0, cur_sum = 0;if (scanf("%d%" SCNd64, &N, &S) != 2) return 1;for (i = 0; i < N; i++) {if (scanf("%d", &A[i]) != 1) return 1;all_sum += A[i];}S %= all_sum;for (i = 0, start = 0; i < 2 * N; i++) {cur_sum += A[i];while (cur_sum > S) cur_sum -= A[start++];if (cur_sum == S) {puts("Yes");
#include <stdio.h>
#include <inttypes.h>
int N;
int64_t S;
int A[212345];
int main(void) {
int i, start;
int64_t all_sum = 0, cur_sum = 0;
if (scanf("%d%" SCNd64, &N, &S) != 2) return 1;
for (i = 0; i < N; i++) {
if (scanf("%d", &A[i]) != 1) return 1;
all_sum += A[i];
}
S %= all_sum;
for (i = 0, start = 0; i < 2 * N; i++) {
cur_sum += A[i];
while (cur_sum > S) cur_sum -= A[start++];
if (cur_sum == S) {
puts("Yes");
return 0;
}
}
puts("No");
return 0;
}
/*
・A_1 ~ A_N で割った余りをとる
・2回繰り返す (間に無限に挟める)
*/
Submission Info
| Submission Time | |
|---|---|
| Task | D - Repeated Sequence |
| User | mikecat |
| Language | C (gcc 12.2.0) |
| Score | 0 |
| Code Size | 620 Byte |
| Status | RE |
| Exec Time | 95 ms |
| Memory | 2444 KB |
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 01_random_40.txt, 01_random_41.txt, 01_random_42.txt, 01_random_43.txt, 01_random_44.txt, 01_random_45.txt, 02_handmade_46.txt, 02_handmade_47.txt, 02_handmade_48.txt, 02_handmade_49.txt, 02_handmade_50.txt, 02_handmade_51.txt, 02_handmade_52.txt, 02_handmade_53.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 0 ms | 1596 KB |
| 00_sample_01.txt | AC | 0 ms | 1572 KB |
| 00_sample_02.txt | AC | 0 ms | 1628 KB |
| 00_sample_03.txt | AC | 0 ms | 1616 KB |
| 01_random_04.txt | AC | 21 ms | 2384 KB |
| 01_random_05.txt | RE | 95 ms | 2264 KB |
| 01_random_06.txt | AC | 22 ms | 2376 KB |
| 01_random_07.txt | RE | 93 ms | 2292 KB |
| 01_random_08.txt | RE | 92 ms | 2240 KB |
| 01_random_09.txt | RE | 93 ms | 2244 KB |
| 01_random_10.txt | RE | 92 ms | 2280 KB |
| 01_random_11.txt | RE | 93 ms | 2240 KB |
| 01_random_12.txt | AC | 21 ms | 2400 KB |
| 01_random_13.txt | AC | 23 ms | 2348 KB |
| 01_random_14.txt | AC | 21 ms | 2364 KB |
| 01_random_15.txt | RE | 95 ms | 2308 KB |
| 01_random_16.txt | AC | 17 ms | 2432 KB |
| 01_random_17.txt | RE | 90 ms | 2280 KB |
| 01_random_18.txt | AC | 17 ms | 2352 KB |
| 01_random_19.txt | RE | 89 ms | 2308 KB |
| 01_random_20.txt | RE | 88 ms | 2260 KB |
| 01_random_21.txt | RE | 89 ms | 2268 KB |
| 01_random_22.txt | RE | 88 ms | 2296 KB |
| 01_random_23.txt | RE | 88 ms | 2372 KB |
| 01_random_24.txt | RE | 89 ms | 2284 KB |
| 01_random_25.txt | AC | 17 ms | 2324 KB |
| 01_random_26.txt | RE | 90 ms | 2260 KB |
| 01_random_27.txt | AC | 17 ms | 2360 KB |
| 01_random_28.txt | AC | 10 ms | 2092 KB |
| 01_random_29.txt | AC | 1 ms | 1580 KB |
| 01_random_30.txt | AC | 2 ms | 1616 KB |
| 01_random_31.txt | WA | 7 ms | 1952 KB |
| 01_random_32.txt | RE | 87 ms | 2108 KB |
| 01_random_33.txt | AC | 0 ms | 1628 KB |
| 01_random_34.txt | AC | 7 ms | 1908 KB |
| 01_random_35.txt | AC | 3 ms | 1688 KB |
| 01_random_36.txt | AC | 3 ms | 1752 KB |
| 01_random_37.txt | RE | 85 ms | 2024 KB |
| 01_random_38.txt | AC | 6 ms | 1888 KB |
| 01_random_39.txt | AC | 2 ms | 1616 KB |
| 01_random_40.txt | RE | 90 ms | 2300 KB |
| 01_random_41.txt | AC | 17 ms | 2292 KB |
| 01_random_42.txt | AC | 18 ms | 2352 KB |
| 01_random_43.txt | AC | 5 ms | 1732 KB |
| 01_random_44.txt | AC | 9 ms | 1964 KB |
| 01_random_45.txt | AC | 2 ms | 1632 KB |
| 02_handmade_46.txt | AC | 9 ms | 2376 KB |
| 02_handmade_47.txt | AC | 0 ms | 1596 KB |
| 02_handmade_48.txt | AC | 9 ms | 2428 KB |
| 02_handmade_49.txt | AC | 0 ms | 1604 KB |
| 02_handmade_50.txt | RE | 89 ms | 2288 KB |
| 02_handmade_51.txt | AC | 14 ms | 2444 KB |
| 02_handmade_52.txt | RE | 84 ms | 2252 KB |
| 02_handmade_53.txt | AC | 10 ms | 2380 KB |