Submission #1778640
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 + 1); vector<long long> sum(10000000000); 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 | 1206 Byte |
Status | RE |
Exec Time | 291 ms |
Memory | 14008 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 | RE | 152 ms | 1408 KB |
02.txt | RE | 117 ms | 1024 KB |
03.txt | RE | 116 ms | 1024 KB |
04.txt | RE | 115 ms | 1024 KB |
05.txt | RE | 116 ms | 1024 KB |
06.txt | RE | 210 ms | 12908 KB |
07.txt | RE | 234 ms | 14008 KB |
08.txt | RE | 227 ms | 12032 KB |
09.txt | RE | 234 ms | 9832 KB |
10.txt | RE | 214 ms | 10292 KB |
11.txt | RE | 204 ms | 11572 KB |
12.txt | RE | 238 ms | 13108 KB |
13.txt | RE | 227 ms | 13168 KB |
14.txt | RE | 209 ms | 11124 KB |
15.txt | RE | 210 ms | 10720 KB |
16.txt | RE | 219 ms | 12624 KB |
17.txt | RE | 228 ms | 13584 KB |
18.txt | RE | 218 ms | 12540 KB |
19.txt | RE | 196 ms | 12132 KB |
20.txt | RE | 223 ms | 13904 KB |
21.txt | RE | 291 ms | 7296 KB |
22.txt | RE | 273 ms | 13040 KB |
23.txt | RE | 220 ms | 7296 KB |
24.txt | RE | 129 ms | 1024 KB |
25.txt | RE | 127 ms | 1024 KB |
26.txt | RE | 126 ms | 1024 KB |
27.txt | RE | 110 ms | 1024 KB |
28.txt | RE | 108 ms | 1024 KB |
29.txt | RE | 109 ms | 1024 KB |
30.txt | RE | 107 ms | 1024 KB |
31.txt | RE | 99 ms | 256 KB |
32.txt | RE | 99 ms | 256 KB |
33.txt | RE | 100 ms | 256 KB |
34.txt | RE | 98 ms | 256 KB |
35.txt | RE | 98 ms | 256 KB |
36.txt | RE | 98 ms | 256 KB |
s1.txt | RE | 97 ms | 256 KB |
s2.txt | RE | 99 ms | 256 KB |