Submission #848257
Source Code Expand
Copy
#include<bits/stdc++.h> using namespace std; #define MAX 100002 int n; int q; vector<long long int> v; map<long long int, long long int> mp; map<long long int, long long int> nex; long long int im[MAX]; int main(){ cin >> n; cin >> q; for (int i = 0; i < q; i++){ long long int a; scanf("%lld", &a); v.push_back(a); } long long int cur_len = v.back(); mp[-cur_len] = 1; for (int i = v.size() - 1; i > 0; i--){ nex.clear(); long long int pr = v[i - 1]; vector<long long int> del; for (auto it = mp.begin(); it != mp.end(); it++){ long long int val = -(*it).first; if (val <= pr){ break; } long long int se = (*it).second; long long int sa = val / pr; nex[pr] += sa*se; sa = val%pr; if (sa){ nex[sa] += se; } del.push_back((*it).first); } for (int j = 0; j < del.size(); j++){ mp.erase(del[j]); } for (auto it = nex.begin(); it != nex.end(); it++){ mp[-(*it).first] += (*it).second; } } for (auto it = mp.begin(); it != mp.end(); it++){ im[-(*it).first] += (*it).second; } for (int i = n-1; i >= 1; i--){ im[i] += im[i + 1]; } for (int i = 1; i <= n; i++){ printf("%lld\n", im[i]); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Sequential operations on Sequence |
User | Kmcode |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1250 Byte |
Status | WA |
Exec Time | 440 ms |
Memory | 10996 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:22:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", &a); ^
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 | 228 ms | 1400 KB |
02.txt | RE | 221 ms | 1400 KB |
03.txt | RE | 221 ms | 1400 KB |
04.txt | RE | 221 ms | 1400 KB |
05.txt | RE | 222 ms | 1400 KB |
06.txt | RE | 359 ms | 8436 KB |
07.txt | RE | 407 ms | 10996 KB |
08.txt | RE | 388 ms | 10100 KB |
09.txt | RE | 422 ms | 8072 KB |
10.txt | RE | 369 ms | 7796 KB |
11.txt | RE | 349 ms | 6388 KB |
12.txt | RE | 409 ms | 9364 KB |
13.txt | RE | 418 ms | 8308 KB |
14.txt | RE | 349 ms | 7540 KB |
15.txt | RE | 339 ms | 6516 KB |
16.txt | RE | 379 ms | 8820 KB |
17.txt | RE | 382 ms | 9108 KB |
18.txt | RE | 367 ms | 8948 KB |
19.txt | RE | 321 ms | 6132 KB |
20.txt | RE | 381 ms | 8948 KB |
21.txt | AC | 397 ms | 8180 KB |
22.txt | RE | 440 ms | 7156 KB |
23.txt | RE | 424 ms | 7284 KB |
24.txt | RE | 255 ms | 1400 KB |
25.txt | RE | 255 ms | 1400 KB |
26.txt | AC | 87 ms | 2164 KB |
27.txt | AC | 39 ms | 2164 KB |
28.txt | AC | 40 ms | 2164 KB |
29.txt | AC | 39 ms | 2164 KB |
30.txt | WA | 40 ms | 2164 KB |
31.txt | AC | 4 ms | 256 KB |
32.txt | RE | 189 ms | 256 KB |
33.txt | AC | 4 ms | 256 KB |
34.txt | RE | 189 ms | 256 KB |
35.txt | WA | 4 ms | 256 KB |
36.txt | RE | 189 ms | 256 KB |
s1.txt | AC | 4 ms | 256 KB |
s2.txt | AC | 4 ms | 256 KB |