Submission #1118035
Source Code Expand
#include <iostream> #include <map> #define INF 1e+18 #define int long long using namespace std; signed main(){ map<int,int> next,cnt; int n,a[100000],prev = 0; cin >> n; int ma = 0; for(int i = 0;i < n;i++){ cin >> a[i]; cnt[a[i]]++; if(ma < a[i]){ ma = a[i]; }else a[i] = 0; } for(auto it = cnt.begin();it != cnt.end();it++){ if(cnt[it->first]){ next[it->first] = it->first - prev; prev = it->first; } } for(auto it = cnt.rbegin();it != cnt.rend();it++) { if(it != cnt.rbegin()) { it--; int c = cnt[it->first]; it++; cnt[it->first] += c; } } for(int i = 0;i < n;i++){ if(a[i]) cout << cnt[a[i]] * next[a[i]] << endl; else cout << 0 << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Frequency |
User | hoget157 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 748 Byte |
Status | WA |
Exec Time | 324 ms |
Memory | 14336 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 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, 37.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
01.txt | WA | 1 ms | 256 KB |
02.txt | WA | 15 ms | 896 KB |
03.txt | WA | 1 ms | 256 KB |
04.txt | WA | 2 ms | 256 KB |
05.txt | WA | 1 ms | 256 KB |
06.txt | WA | 1 ms | 256 KB |
07.txt | WA | 1 ms | 256 KB |
08.txt | WA | 2 ms | 256 KB |
09.txt | WA | 21 ms | 1152 KB |
10.txt | WA | 1 ms | 256 KB |
11.txt | WA | 240 ms | 8960 KB |
12.txt | WA | 234 ms | 8960 KB |
13.txt | WA | 232 ms | 8960 KB |
14.txt | WA | 233 ms | 8960 KB |
15.txt | WA | 235 ms | 8960 KB |
16.txt | AC | 193 ms | 1280 KB |
17.txt | AC | 324 ms | 14080 KB |
18.txt | WA | 288 ms | 13696 KB |
19.txt | AC | 166 ms | 1280 KB |
20.txt | WA | 208 ms | 6144 KB |
21.txt | AC | 1 ms | 256 KB |
22.txt | AC | 1 ms | 256 KB |
23.txt | WA | 1 ms | 256 KB |
24.txt | WA | 16 ms | 1024 KB |
25.txt | WA | 2 ms | 256 KB |
26.txt | WA | 3 ms | 384 KB |
27.txt | WA | 1 ms | 256 KB |
28.txt | WA | 286 ms | 14208 KB |
29.txt | WA | 283 ms | 14336 KB |
30.txt | WA | 298 ms | 14336 KB |
31.txt | WA | 285 ms | 14208 KB |
32.txt | WA | 284 ms | 14208 KB |
33.txt | WA | 258 ms | 13696 KB |
34.txt | WA | 262 ms | 13696 KB |
35.txt | WA | 270 ms | 13696 KB |
36.txt | WA | 258 ms | 13696 KB |
37.txt | WA | 255 ms | 13696 KB |