Submission #1687444
Source Code Expand
#include <bits/stdc++.h> typedef long long LL; const int maxn = 1e5 + 100; int n, m, q_n; LL q[maxn], coef[maxn], ans; std::vector<int> has[maxn]; int main() { scanf("%d%d", &n, &q_n); q[m++] = n; while(q_n--) { scanf("%lld", q + m); while(m && q[m] <= q[m - 1]) { q[m - 1] = q[m]; --m; } ++m; } if(m == 1) { for (int i = 1; i <= q[0]; ++i) { puts("1"); } for(int i = q[0] + 1; i <= n; ++i) { puts("0"); } return 0; } coef[m - 1] = 1; for (int i = m - 2; i >= 0; --i) { coef[i] = q[i + 1] / q[i] * coef[i + 1]; } ans = coef[0]; for (int i = 1; i < m; ++i) { LL t = q[i] % q[i - 1] / n; has[q[i] % q[i - 1] % n + 1].push_back(i); if(q[i] % q[i - 1] % n) { ++t; } ans += t * coef[i]; } printf("%lld\n", ans); for (int i = 2; i <= q[0]; ++i) { for (int j: has[i]) { ans -= coef[j]; } printf("%lld\n", ans); } for(int i = q[0] + 1; i <= n; ++i) { puts("0"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Sequential operations on Sequence |
User | OMTWOCZWEIXVI |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 999 Byte |
Status | WA |
Exec Time | 48 ms |
Memory | 7424 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &n, &q_n); ^ ./Main.cpp:15:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", q + m); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 30 ms | 3840 KB |
02.txt | WA | 31 ms | 3968 KB |
03.txt | WA | 31 ms | 3968 KB |
04.txt | WA | 31 ms | 3968 KB |
05.txt | WA | 31 ms | 3968 KB |
06.txt | WA | 47 ms | 7168 KB |
07.txt | WA | 47 ms | 7296 KB |
08.txt | WA | 47 ms | 7424 KB |
09.txt | WA | 47 ms | 7168 KB |
10.txt | WA | 47 ms | 7296 KB |
11.txt | WA | 47 ms | 7424 KB |
12.txt | WA | 47 ms | 7168 KB |
13.txt | WA | 47 ms | 7296 KB |
14.txt | WA | 47 ms | 7296 KB |
15.txt | WA | 47 ms | 7168 KB |
16.txt | WA | 47 ms | 7296 KB |
17.txt | WA | 48 ms | 7424 KB |
18.txt | WA | 47 ms | 7168 KB |
19.txt | WA | 47 ms | 7296 KB |
20.txt | WA | 48 ms | 7424 KB |
21.txt | WA | 31 ms | 5248 KB |
22.txt | WA | 37 ms | 5888 KB |
23.txt | WA | 42 ms | 7040 KB |
24.txt | WA | 33 ms | 5880 KB |
25.txt | WA | 32 ms | 5880 KB |
26.txt | WA | 23 ms | 4856 KB |
27.txt | AC | 14 ms | 2816 KB |
28.txt | AC | 14 ms | 2816 KB |
29.txt | AC | 14 ms | 2816 KB |
30.txt | AC | 21 ms | 2816 KB |
31.txt | AC | 3 ms | 2560 KB |
32.txt | AC | 5 ms | 2816 KB |
33.txt | AC | 3 ms | 2560 KB |
34.txt | AC | 14 ms | 4096 KB |
35.txt | AC | 3 ms | 2560 KB |
36.txt | AC | 3 ms | 2560 KB |
s1.txt | AC | 2 ms | 2560 KB |
s2.txt | AC | 3 ms | 2560 KB |