Submission #1778641
Source Code Expand
#include <cstdio> #include <vector> #include <map> using namespace std; int main() { int first; long long n; scanf("%d%lld", &first, &n); vector<long long> q(n + 1); q[0] = first; for (int i = 1; i <= n; i ++) scanf("%lld", &q[i]); map<long long, long long, greater<long long>> mp; mp[q[n]] = 1; for (int i = n - 1; i >= 0; i --) { vector<pair<long long, long long>> v; for (auto p : mp) { if (p.first <= q[i]) break; v.push_back(make_pair(q[i], (p.first / q[i]) * p.second)); v.push_back(make_pair(p.first % q[i], p.second)); } while (mp.size() && q[i] < mp.begin() -> first) mp.erase(mp.begin()); for (auto p : v) mp[p.first] += p.second; } vector<long long> sum(first); for (auto p : mp) sum[p.first - 1] += p.second; for (int i = first - 2; i >= 0; i --) sum[i] += sum[i + 1]; for (int i = 0; i < first; i ++) printf("%lld\n", sum[i]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Sequential operations on Sequence |
User | KokiYmgch |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1155 Byte |
Status | RE |
Exec Time | 276 ms |
Memory | 14076 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%lld", &first, &n); ^ ./Main.cpp:12:59: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for (int i = 1; i <= n; i ++) scanf("%lld", &q[i]); ^
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 | AC | 29 ms | 3072 KB |
02.txt | AC | 29 ms | 3200 KB |
03.txt | AC | 29 ms | 3200 KB |
04.txt | AC | 29 ms | 3200 KB |
05.txt | AC | 29 ms | 3200 KB |
06.txt | AC | 126 ms | 12908 KB |
07.txt | RE | 257 ms | 13140 KB |
08.txt | RE | 242 ms | 13952 KB |
09.txt | AC | 141 ms | 9832 KB |
10.txt | RE | 219 ms | 10804 KB |
11.txt | AC | 123 ms | 11188 KB |
12.txt | AC | 143 ms | 12212 KB |
13.txt | AC | 142 ms | 12912 KB |
14.txt | AC | 131 ms | 11124 KB |
15.txt | RE | 216 ms | 10080 KB |
16.txt | RE | 226 ms | 13264 KB |
17.txt | RE | 227 ms | 13968 KB |
18.txt | RE | 220 ms | 14076 KB |
19.txt | RE | 205 ms | 11876 KB |
20.txt | RE | 234 ms | 12240 KB |
21.txt | RE | 276 ms | 7536 KB |
22.txt | RE | 257 ms | 12144 KB |
23.txt | RE | 202 ms | 7296 KB |
24.txt | AC | 42 ms | 3072 KB |
25.txt | AC | 40 ms | 2944 KB |
26.txt | AC | 36 ms | 2048 KB |
27.txt | AC | 19 ms | 2048 KB |
28.txt | AC | 20 ms | 2048 KB |
29.txt | AC | 19 ms | 2048 KB |
30.txt | AC | 20 ms | 2048 KB |
31.txt | AC | 1 ms | 256 KB |
32.txt | AC | 9 ms | 1152 KB |
33.txt | AC | 1 ms | 256 KB |
34.txt | AC | 13 ms | 2432 KB |
35.txt | AC | 1 ms | 256 KB |
36.txt | RE | 95 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |