# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
259304 |
2020-08-07T14:19:14 Z |
최은수(#5042) |
역사적 조사 (JOI14_historical) |
C++17 |
|
4000 ms |
3936 KB |
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18+7;
int cnt[100010];
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,q;
cin>>n>>q;
vector<ll>v(n),sv;
for(ll&t:v)
cin>>t,sv.eb(t);
sort(all(sv));
sv.erase(unique(all(sv)),sv.end());
v.insert(v.begin(),v[0]);
for(ll&t:v)
t=lower_bound(all(sv),t)-sv.begin();
for(int i=0;i<q;i++)
{
int s,e;
cin>>s>>e;
ll ans=0;
for(int j=s;j<=e;j++)
ans=max(ans,sv[v[j]]*++cnt[v[j]]);
cout<<ans<<'\n';
for(int j=s;j<=e;j++)
cnt[v[j]]--;
}
cout.flush();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
0 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
0 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
7 ms |
512 KB |
Output is correct |
20 |
Correct |
23 ms |
512 KB |
Output is correct |
21 |
Correct |
53 ms |
640 KB |
Output is correct |
22 |
Correct |
56 ms |
640 KB |
Output is correct |
23 |
Correct |
53 ms |
640 KB |
Output is correct |
24 |
Correct |
52 ms |
640 KB |
Output is correct |
25 |
Correct |
54 ms |
640 KB |
Output is correct |
26 |
Correct |
53 ms |
640 KB |
Output is correct |
27 |
Correct |
52 ms |
732 KB |
Output is correct |
28 |
Correct |
54 ms |
768 KB |
Output is correct |
29 |
Correct |
54 ms |
640 KB |
Output is correct |
30 |
Correct |
54 ms |
640 KB |
Output is correct |
31 |
Correct |
52 ms |
708 KB |
Output is correct |
32 |
Correct |
52 ms |
640 KB |
Output is correct |
33 |
Correct |
53 ms |
640 KB |
Output is correct |
34 |
Correct |
52 ms |
640 KB |
Output is correct |
35 |
Correct |
52 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
512 KB |
Output is correct |
7 |
Correct |
3 ms |
640 KB |
Output is correct |
8 |
Correct |
5 ms |
896 KB |
Output is correct |
9 |
Correct |
10 ms |
1332 KB |
Output is correct |
10 |
Correct |
9 ms |
1916 KB |
Output is correct |
11 |
Correct |
91 ms |
3420 KB |
Output is correct |
12 |
Correct |
28 ms |
3192 KB |
Output is correct |
13 |
Correct |
98 ms |
3312 KB |
Output is correct |
14 |
Correct |
119 ms |
3456 KB |
Output is correct |
15 |
Correct |
70 ms |
3936 KB |
Output is correct |
16 |
Execution timed out |
4050 ms |
3448 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
0 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
7 ms |
512 KB |
Output is correct |
20 |
Correct |
23 ms |
512 KB |
Output is correct |
21 |
Correct |
53 ms |
640 KB |
Output is correct |
22 |
Correct |
56 ms |
640 KB |
Output is correct |
23 |
Correct |
53 ms |
640 KB |
Output is correct |
24 |
Correct |
52 ms |
640 KB |
Output is correct |
25 |
Correct |
54 ms |
640 KB |
Output is correct |
26 |
Correct |
53 ms |
640 KB |
Output is correct |
27 |
Correct |
52 ms |
732 KB |
Output is correct |
28 |
Correct |
54 ms |
768 KB |
Output is correct |
29 |
Correct |
54 ms |
640 KB |
Output is correct |
30 |
Correct |
54 ms |
640 KB |
Output is correct |
31 |
Correct |
52 ms |
708 KB |
Output is correct |
32 |
Correct |
52 ms |
640 KB |
Output is correct |
33 |
Correct |
53 ms |
640 KB |
Output is correct |
34 |
Correct |
52 ms |
640 KB |
Output is correct |
35 |
Correct |
52 ms |
640 KB |
Output is correct |
36 |
Correct |
1 ms |
384 KB |
Output is correct |
37 |
Correct |
1 ms |
512 KB |
Output is correct |
38 |
Correct |
1 ms |
384 KB |
Output is correct |
39 |
Correct |
1 ms |
384 KB |
Output is correct |
40 |
Correct |
1 ms |
384 KB |
Output is correct |
41 |
Correct |
1 ms |
512 KB |
Output is correct |
42 |
Correct |
3 ms |
640 KB |
Output is correct |
43 |
Correct |
5 ms |
896 KB |
Output is correct |
44 |
Correct |
10 ms |
1332 KB |
Output is correct |
45 |
Correct |
9 ms |
1916 KB |
Output is correct |
46 |
Correct |
91 ms |
3420 KB |
Output is correct |
47 |
Correct |
28 ms |
3192 KB |
Output is correct |
48 |
Correct |
98 ms |
3312 KB |
Output is correct |
49 |
Correct |
119 ms |
3456 KB |
Output is correct |
50 |
Correct |
70 ms |
3936 KB |
Output is correct |
51 |
Execution timed out |
4050 ms |
3448 KB |
Time limit exceeded |
52 |
Halted |
0 ms |
0 KB |
- |