Submission #1117694
Source Code Expand
#include <iostream> #define INF 1e+18 #define int long long using namespace std; signed main(){ int n,a[100000],cnt[100002] = {},next[100002] = {},prev = 0,first[100000] = {}; bool used[100001] = {}; cin >> n; int ma = 0; for(int i = 0;i < n;i++){ cin >> a[i]; cnt[a[i]]++; if(ma < a[i]){ first[i] = a[i]; ma = a[i]; } } for(int i = 1;i <= 100000;i++){ if(cnt[i]){ next[i] = i - prev; prev = i; used[i] = true; } } for(int i = 100000;i >= 1;i--) { cnt[i] += cnt[i + 1]; } for(int i = 0;i < n;i++){ if(first[i]) cout << cnt[first[i]] * next[first[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 | 677 Byte |
Status | RE |
Exec Time | 201 ms |
Memory | 3584 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 | 2 ms | 2944 KB |
00_example_02.txt | AC | 2 ms | 2560 KB |
01.txt | RE | 201 ms | 2560 KB |
02.txt | RE | 99 ms | 2560 KB |
03.txt | RE | 98 ms | 2560 KB |
04.txt | RE | 98 ms | 2560 KB |
05.txt | RE | 97 ms | 2560 KB |
06.txt | RE | 100 ms | 2688 KB |
07.txt | RE | 97 ms | 2816 KB |
08.txt | RE | 97 ms | 2560 KB |
09.txt | RE | 97 ms | 3200 KB |
10.txt | RE | 97 ms | 3200 KB |
11.txt | RE | 99 ms | 3072 KB |
12.txt | RE | 97 ms | 2560 KB |
13.txt | RE | 98 ms | 2560 KB |
14.txt | RE | 97 ms | 2560 KB |
15.txt | RE | 98 ms | 2560 KB |
16.txt | RE | 98 ms | 2560 KB |
17.txt | RE | 97 ms | 2560 KB |
18.txt | RE | 97 ms | 2560 KB |
19.txt | AC | 165 ms | 3584 KB |
20.txt | RE | 97 ms | 2560 KB |
21.txt | RE | 97 ms | 2560 KB |
22.txt | AC | 2 ms | 3072 KB |
23.txt | RE | 97 ms | 3328 KB |
24.txt | RE | 99 ms | 2944 KB |
25.txt | RE | 98 ms | 2560 KB |
26.txt | RE | 97 ms | 2560 KB |
27.txt | RE | 98 ms | 2560 KB |
28.txt | RE | 98 ms | 3328 KB |
29.txt | RE | 98 ms | 2560 KB |
30.txt | RE | 98 ms | 2560 KB |
31.txt | RE | 98 ms | 3072 KB |
32.txt | RE | 101 ms | 2560 KB |
33.txt | RE | 97 ms | 2560 KB |
34.txt | RE | 99 ms | 2560 KB |
35.txt | RE | 97 ms | 2560 KB |
36.txt | RE | 96 ms | 2816 KB |
37.txt | RE | 100 ms | 2560 KB |