Submission #811597

# Submission time Handle Problem Language Result Execution time Memory
811597 2023-08-07T05:03:57 Z t6twotwo Diversity (CEOI21_diversity) C++17
64 / 100
183 ms 17156 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FFOR(i,a,b,c) for(int i=(a);(c)>0?i<=(b):i>=(b);i+=(c))
#define FOOR(i,a,b) FFOR(i,a,b-1,1)
#define ROOF(i,a,b) FFOR(i,b-1,a,-1)
#define FOR(i,n) FOOR(i,0,n)
#define ROF(i,n) ROOF(i,0,n)
#define FORR(x,v) for(auto &x:v)
#define all(v) (v).begin(),(v).end()
#define lla(v) (v).rbegin(),(v).rend()
#define sz(v) (int)((v).size())
#define vc vector
#define pb push_back
#define ppb pop_back
#define bk back()
#define fr front()
#define pp pop()
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define bg begin()
#define en end()
#define em empty()
#define f first
#define s second
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,Q;
    cin>>N>>Q;
    vc<int>A(N);
    map<int,int> mp;
    FORR(x,A)cin>>x,mp[x]++;
    int l,r;
    cin>>l>>r;
    vc<int> f;
    for(auto[x,y]:mp) f.pb(y);
    sort(lla(f));
    deque<int> dq;
    FOR(i,sz(f)) {
        i%2==1?dq.pb(f[i]):dq.push_front(f[i]);
    }
    ll ans=0,t=0;
    FOR(i,sz(dq)){
        ans+=t*(N-t);
        FOR(j,dq[i]){
            ans+=N-t;
            t++;
        }
    }
    cout<<ans;
    return 6/22;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 6 ms 852 KB Output is correct
5 Correct 10 ms 1492 KB Output is correct
6 Correct 16 ms 2132 KB Output is correct
7 Correct 14 ms 2004 KB Output is correct
8 Correct 16 ms 2124 KB Output is correct
9 Correct 15 ms 2132 KB Output is correct
10 Correct 15 ms 2124 KB Output is correct
11 Correct 16 ms 2132 KB Output is correct
12 Correct 16 ms 2132 KB Output is correct
13 Correct 15 ms 2132 KB Output is correct
14 Correct 15 ms 2132 KB Output is correct
15 Correct 15 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 6 ms 852 KB Output is correct
5 Correct 10 ms 1492 KB Output is correct
6 Correct 16 ms 2132 KB Output is correct
7 Correct 14 ms 2004 KB Output is correct
8 Correct 16 ms 2124 KB Output is correct
9 Correct 15 ms 2132 KB Output is correct
10 Correct 15 ms 2124 KB Output is correct
11 Correct 16 ms 2132 KB Output is correct
12 Correct 16 ms 2132 KB Output is correct
13 Correct 15 ms 2132 KB Output is correct
14 Correct 15 ms 2132 KB Output is correct
15 Correct 15 ms 2132 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 6 ms 980 KB Output is correct
20 Correct 12 ms 1652 KB Output is correct
21 Correct 18 ms 2328 KB Output is correct
22 Correct 18 ms 2292 KB Output is correct
23 Correct 18 ms 2256 KB Output is correct
24 Correct 18 ms 2252 KB Output is correct
25 Correct 19 ms 2252 KB Output is correct
26 Correct 22 ms 2260 KB Output is correct
27 Correct 19 ms 2256 KB Output is correct
28 Correct 18 ms 2184 KB Output is correct
29 Correct 18 ms 2132 KB Output is correct
30 Correct 18 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 6 ms 852 KB Output is correct
5 Correct 10 ms 1492 KB Output is correct
6 Correct 16 ms 2132 KB Output is correct
7 Correct 14 ms 2004 KB Output is correct
8 Correct 16 ms 2124 KB Output is correct
9 Correct 15 ms 2132 KB Output is correct
10 Correct 15 ms 2124 KB Output is correct
11 Correct 16 ms 2132 KB Output is correct
12 Correct 16 ms 2132 KB Output is correct
13 Correct 15 ms 2132 KB Output is correct
14 Correct 15 ms 2132 KB Output is correct
15 Correct 15 ms 2132 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 6 ms 980 KB Output is correct
20 Correct 12 ms 1652 KB Output is correct
21 Correct 18 ms 2328 KB Output is correct
22 Correct 18 ms 2292 KB Output is correct
23 Correct 18 ms 2256 KB Output is correct
24 Correct 18 ms 2252 KB Output is correct
25 Correct 19 ms 2252 KB Output is correct
26 Correct 22 ms 2260 KB Output is correct
27 Correct 19 ms 2256 KB Output is correct
28 Correct 18 ms 2184 KB Output is correct
29 Correct 18 ms 2132 KB Output is correct
30 Correct 18 ms 2252 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 5 ms 724 KB Output is correct
38 Correct 5 ms 724 KB Output is correct
39 Correct 10 ms 1108 KB Output is correct
40 Correct 19 ms 1916 KB Output is correct
41 Correct 29 ms 2684 KB Output is correct
42 Correct 29 ms 2672 KB Output is correct
43 Correct 28 ms 2564 KB Output is correct
44 Correct 29 ms 2636 KB Output is correct
45 Correct 28 ms 2676 KB Output is correct
46 Correct 29 ms 2676 KB Output is correct
47 Correct 28 ms 2680 KB Output is correct
48 Correct 30 ms 2552 KB Output is correct
49 Correct 29 ms 2552 KB Output is correct
50 Correct 29 ms 2672 KB Output is correct
51 Correct 28 ms 2688 KB Output is correct
52 Correct 28 ms 2636 KB Output is correct
53 Correct 28 ms 2680 KB Output is correct
54 Correct 28 ms 2636 KB Output is correct
55 Correct 28 ms 2680 KB Output is correct
56 Correct 30 ms 2624 KB Output is correct
57 Correct 28 ms 2556 KB Output is correct
58 Correct 28 ms 2688 KB Output is correct
59 Correct 28 ms 2684 KB Output is correct
60 Correct 28 ms 2632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 6 ms 852 KB Output is correct
15 Correct 10 ms 1492 KB Output is correct
16 Correct 16 ms 2132 KB Output is correct
17 Correct 14 ms 2004 KB Output is correct
18 Correct 16 ms 2124 KB Output is correct
19 Correct 15 ms 2132 KB Output is correct
20 Correct 15 ms 2124 KB Output is correct
21 Correct 16 ms 2132 KB Output is correct
22 Correct 16 ms 2132 KB Output is correct
23 Correct 15 ms 2132 KB Output is correct
24 Correct 15 ms 2132 KB Output is correct
25 Correct 15 ms 2132 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 320 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 6 ms 980 KB Output is correct
30 Correct 12 ms 1652 KB Output is correct
31 Correct 18 ms 2328 KB Output is correct
32 Correct 18 ms 2292 KB Output is correct
33 Correct 18 ms 2256 KB Output is correct
34 Correct 18 ms 2252 KB Output is correct
35 Correct 19 ms 2252 KB Output is correct
36 Correct 22 ms 2260 KB Output is correct
37 Correct 19 ms 2256 KB Output is correct
38 Correct 18 ms 2184 KB Output is correct
39 Correct 18 ms 2132 KB Output is correct
40 Correct 18 ms 2252 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 2 ms 340 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 5 ms 724 KB Output is correct
49 Correct 10 ms 1108 KB Output is correct
50 Correct 19 ms 1916 KB Output is correct
51 Correct 29 ms 2684 KB Output is correct
52 Correct 29 ms 2672 KB Output is correct
53 Correct 28 ms 2564 KB Output is correct
54 Correct 29 ms 2636 KB Output is correct
55 Correct 28 ms 2676 KB Output is correct
56 Correct 29 ms 2676 KB Output is correct
57 Correct 28 ms 2680 KB Output is correct
58 Correct 30 ms 2552 KB Output is correct
59 Correct 29 ms 2552 KB Output is correct
60 Correct 29 ms 2672 KB Output is correct
61 Correct 28 ms 2688 KB Output is correct
62 Correct 28 ms 2636 KB Output is correct
63 Correct 28 ms 2680 KB Output is correct
64 Correct 28 ms 2636 KB Output is correct
65 Correct 28 ms 2680 KB Output is correct
66 Correct 30 ms 2624 KB Output is correct
67 Correct 28 ms 2556 KB Output is correct
68 Correct 28 ms 2688 KB Output is correct
69 Correct 28 ms 2684 KB Output is correct
70 Correct 28 ms 2632 KB Output is correct
71 Correct 6 ms 836 KB Output is correct
72 Correct 6 ms 852 KB Output is correct
73 Correct 6 ms 852 KB Output is correct
74 Correct 6 ms 840 KB Output is correct
75 Correct 6 ms 852 KB Output is correct
76 Correct 14 ms 1364 KB Output is correct
77 Correct 13 ms 1352 KB Output is correct
78 Correct 13 ms 1440 KB Output is correct
79 Correct 14 ms 1364 KB Output is correct
80 Correct 14 ms 1364 KB Output is correct
81 Correct 30 ms 2576 KB Output is correct
82 Correct 30 ms 2632 KB Output is correct
83 Correct 29 ms 2576 KB Output is correct
84 Correct 30 ms 2568 KB Output is correct
85 Correct 36 ms 2672 KB Output is correct
86 Correct 36 ms 3276 KB Output is correct
87 Correct 36 ms 3232 KB Output is correct
88 Correct 36 ms 3300 KB Output is correct
89 Correct 37 ms 3204 KB Output is correct
90 Correct 38 ms 3304 KB Output is correct
91 Correct 80 ms 8692 KB Output is correct
92 Correct 90 ms 8684 KB Output is correct
93 Correct 92 ms 8696 KB Output is correct
94 Correct 81 ms 8616 KB Output is correct
95 Correct 80 ms 8696 KB Output is correct
96 Correct 118 ms 14276 KB Output is correct
97 Correct 129 ms 14368 KB Output is correct
98 Correct 130 ms 14304 KB Output is correct
99 Correct 122 ms 14304 KB Output is correct
100 Correct 122 ms 14308 KB Output is correct
101 Correct 138 ms 14344 KB Output is correct
102 Correct 118 ms 14344 KB Output is correct
103 Correct 183 ms 14276 KB Output is correct
104 Correct 104 ms 14328 KB Output is correct
105 Correct 136 ms 14332 KB Output is correct
106 Correct 182 ms 17040 KB Output is correct
107 Correct 170 ms 17076 KB Output is correct
108 Correct 121 ms 17156 KB Output is correct
109 Correct 128 ms 17064 KB Output is correct
110 Correct 122 ms 17060 KB Output is correct
111 Correct 165 ms 17056 KB Output is correct
112 Correct 174 ms 17156 KB Output is correct
113 Correct 128 ms 17076 KB Output is correct
114 Correct 156 ms 17128 KB Output is correct
115 Correct 183 ms 17132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 6 ms 852 KB Output is correct
15 Correct 10 ms 1492 KB Output is correct
16 Correct 16 ms 2132 KB Output is correct
17 Correct 14 ms 2004 KB Output is correct
18 Correct 16 ms 2124 KB Output is correct
19 Correct 15 ms 2132 KB Output is correct
20 Correct 15 ms 2124 KB Output is correct
21 Correct 16 ms 2132 KB Output is correct
22 Correct 16 ms 2132 KB Output is correct
23 Correct 15 ms 2132 KB Output is correct
24 Correct 15 ms 2132 KB Output is correct
25 Correct 15 ms 2132 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 320 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 6 ms 980 KB Output is correct
30 Correct 12 ms 1652 KB Output is correct
31 Correct 18 ms 2328 KB Output is correct
32 Correct 18 ms 2292 KB Output is correct
33 Correct 18 ms 2256 KB Output is correct
34 Correct 18 ms 2252 KB Output is correct
35 Correct 19 ms 2252 KB Output is correct
36 Correct 22 ms 2260 KB Output is correct
37 Correct 19 ms 2256 KB Output is correct
38 Correct 18 ms 2184 KB Output is correct
39 Correct 18 ms 2132 KB Output is correct
40 Correct 18 ms 2252 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 2 ms 340 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 5 ms 724 KB Output is correct
49 Correct 10 ms 1108 KB Output is correct
50 Correct 19 ms 1916 KB Output is correct
51 Correct 29 ms 2684 KB Output is correct
52 Correct 29 ms 2672 KB Output is correct
53 Correct 28 ms 2564 KB Output is correct
54 Correct 29 ms 2636 KB Output is correct
55 Correct 28 ms 2676 KB Output is correct
56 Correct 29 ms 2676 KB Output is correct
57 Correct 28 ms 2680 KB Output is correct
58 Correct 30 ms 2552 KB Output is correct
59 Correct 29 ms 2552 KB Output is correct
60 Correct 29 ms 2672 KB Output is correct
61 Correct 28 ms 2688 KB Output is correct
62 Correct 28 ms 2636 KB Output is correct
63 Correct 28 ms 2680 KB Output is correct
64 Correct 28 ms 2636 KB Output is correct
65 Correct 28 ms 2680 KB Output is correct
66 Correct 30 ms 2624 KB Output is correct
67 Correct 28 ms 2556 KB Output is correct
68 Correct 28 ms 2688 KB Output is correct
69 Correct 28 ms 2684 KB Output is correct
70 Correct 28 ms 2632 KB Output is correct
71 Correct 6 ms 836 KB Output is correct
72 Correct 6 ms 852 KB Output is correct
73 Correct 6 ms 852 KB Output is correct
74 Correct 6 ms 840 KB Output is correct
75 Correct 6 ms 852 KB Output is correct
76 Correct 14 ms 1364 KB Output is correct
77 Correct 13 ms 1352 KB Output is correct
78 Correct 13 ms 1440 KB Output is correct
79 Correct 14 ms 1364 KB Output is correct
80 Correct 14 ms 1364 KB Output is correct
81 Correct 30 ms 2576 KB Output is correct
82 Correct 30 ms 2632 KB Output is correct
83 Correct 29 ms 2576 KB Output is correct
84 Correct 30 ms 2568 KB Output is correct
85 Correct 36 ms 2672 KB Output is correct
86 Correct 36 ms 3276 KB Output is correct
87 Correct 36 ms 3232 KB Output is correct
88 Correct 36 ms 3300 KB Output is correct
89 Correct 37 ms 3204 KB Output is correct
90 Correct 38 ms 3304 KB Output is correct
91 Correct 80 ms 8692 KB Output is correct
92 Correct 90 ms 8684 KB Output is correct
93 Correct 92 ms 8696 KB Output is correct
94 Correct 81 ms 8616 KB Output is correct
95 Correct 80 ms 8696 KB Output is correct
96 Correct 118 ms 14276 KB Output is correct
97 Correct 129 ms 14368 KB Output is correct
98 Correct 130 ms 14304 KB Output is correct
99 Correct 122 ms 14304 KB Output is correct
100 Correct 122 ms 14308 KB Output is correct
101 Correct 138 ms 14344 KB Output is correct
102 Correct 118 ms 14344 KB Output is correct
103 Correct 183 ms 14276 KB Output is correct
104 Correct 104 ms 14328 KB Output is correct
105 Correct 136 ms 14332 KB Output is correct
106 Correct 182 ms 17040 KB Output is correct
107 Correct 170 ms 17076 KB Output is correct
108 Correct 121 ms 17156 KB Output is correct
109 Correct 128 ms 17064 KB Output is correct
110 Correct 122 ms 17060 KB Output is correct
111 Correct 165 ms 17056 KB Output is correct
112 Correct 174 ms 17156 KB Output is correct
113 Correct 128 ms 17076 KB Output is correct
114 Correct 156 ms 17128 KB Output is correct
115 Correct 183 ms 17132 KB Output is correct
116 Incorrect 2 ms 468 KB Output isn't correct
117 Halted 0 ms 0 KB -