Submission #26147221
Source Code Expand
import bisect
n = int(input())
a = list(map(int, input().split()))
x = int(input())
acc = [0] * n
acc[0] = a[0]
for i in range(1, n):
acc[i] = acc[i - 1] + a[i]
sum_a = acc[- 1]
times = x // sum_a
mod = x % sum_a
idx = bisect.bisect_right(acc, mod)
res = times * n + idx + 1
print(res)
Submission Info
| Submission Time | |
|---|---|
| Task | C - Long Sequence |
| User | cubesat |
| Language | PyPy3 (7.3.0) |
| Score | 300 |
| Code Size | 317 Byte |
| Status | AC |
| Exec Time | 86 ms |
| Memory | 84328 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 76 ms | 61836 KiB |
| 001.txt | AC | 53 ms | 61756 KiB |
| 002.txt | AC | 52 ms | 61668 KiB |
| 003.txt | AC | 85 ms | 83920 KiB |
| 004.txt | AC | 83 ms | 84264 KiB |
| 005.txt | AC | 86 ms | 84060 KiB |
| 006.txt | AC | 64 ms | 69916 KiB |
| 007.txt | AC | 64 ms | 70424 KiB |
| 008.txt | AC | 62 ms | 68928 KiB |
| 009.txt | AC | 83 ms | 83916 KiB |
| 010.txt | AC | 86 ms | 83992 KiB |
| 011.txt | AC | 84 ms | 84328 KiB |
| 012.txt | AC | 73 ms | 77100 KiB |
| 013.txt | AC | 64 ms | 71712 KiB |
| 014.txt | AC | 68 ms | 73216 KiB |
| 015.txt | AC | 86 ms | 84304 KiB |
| 016.txt | AC | 83 ms | 84180 KiB |
| 017.txt | AC | 82 ms | 83028 KiB |
| 018.txt | AC | 75 ms | 77268 KiB |
| 019.txt | AC | 82 ms | 82488 KiB |
| 020.txt | AC | 75 ms | 78300 KiB |
| 021.txt | AC | 62 ms | 69116 KiB |
| example0.txt | AC | 54 ms | 62108 KiB |
| example1.txt | AC | 53 ms | 61848 KiB |