Submission #888904

# Submission time Handle Problem Language Result Execution time Memory
888904 2023-12-18T11:29:13 Z adaawf Cryptography (NOI20_crypto) C++14
100 / 100
414 ms 22356 KB
#include <iostream>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
long long int a[300005], f[300005], mod = 1e9 + 7;
int main() {
    int n;
    cin >> n;
    ordered_set s;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        s.insert(a[i]);
    }
    f[n + 1] = 1;
    for (int i = n; i >= 1; i--) {
        f[i] = f[i + 1] * (n - i + 1) % mod;
    }
    long long int res = 0;
    for (int i = 1; i <= n; i++) {
        res = (res + s.order_of_key(a[i]) * f[i + 1]) % mod;
        s.erase(s.find(a[i]));
    }
    cout << (res + 1) % mod;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2408 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2500 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2548 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 386 ms 22112 KB Output is correct
3 Correct 389 ms 22092 KB Output is correct
4 Correct 390 ms 21948 KB Output is correct
5 Correct 397 ms 22076 KB Output is correct
6 Correct 410 ms 22084 KB Output is correct
7 Correct 377 ms 22000 KB Output is correct
8 Correct 388 ms 22100 KB Output is correct
9 Correct 398 ms 22100 KB Output is correct
10 Correct 388 ms 21956 KB Output is correct
11 Correct 414 ms 22104 KB Output is correct
12 Correct 397 ms 22100 KB Output is correct
13 Correct 397 ms 22356 KB Output is correct
14 Correct 393 ms 22100 KB Output is correct
15 Correct 373 ms 22356 KB Output is correct
16 Correct 379 ms 22044 KB Output is correct
17 Correct 366 ms 22100 KB Output is correct
18 Correct 380 ms 22012 KB Output is correct
19 Correct 402 ms 21932 KB Output is correct
20 Correct 389 ms 22100 KB Output is correct
21 Correct 376 ms 22076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 319 ms 21040 KB Output is correct
3 Correct 317 ms 21036 KB Output is correct
4 Correct 336 ms 21144 KB Output is correct
5 Correct 325 ms 21440 KB Output is correct
6 Correct 304 ms 20948 KB Output is correct
7 Correct 339 ms 21144 KB Output is correct
8 Correct 345 ms 21072 KB Output is correct
9 Correct 356 ms 21072 KB Output is correct
10 Correct 319 ms 21052 KB Output is correct
11 Correct 302 ms 21076 KB Output is correct
12 Correct 335 ms 21480 KB Output is correct
13 Correct 312 ms 21148 KB Output is correct
14 Correct 317 ms 21084 KB Output is correct
15 Correct 322 ms 21072 KB Output is correct
16 Correct 320 ms 20928 KB Output is correct
17 Correct 312 ms 21076 KB Output is correct
18 Correct 305 ms 21140 KB Output is correct
19 Correct 302 ms 21076 KB Output is correct
20 Correct 326 ms 21328 KB Output is correct
21 Correct 313 ms 21072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
5 Correct 2 ms 2584 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 3 ms 2904 KB Output is correct
8 Correct 2 ms 2652 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 2 ms 2652 KB Output is correct
12 Correct 2 ms 2652 KB Output is correct
13 Correct 2 ms 2652 KB Output is correct
14 Correct 2 ms 2652 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 2 ms 2652 KB Output is correct
17 Correct 2 ms 2652 KB Output is correct
18 Correct 2 ms 2500 KB Output is correct
19 Correct 2 ms 2652 KB Output is correct
20 Correct 2 ms 2668 KB Output is correct
21 Correct 2 ms 2652 KB Output is correct
22 Correct 2 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2408 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2500 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2548 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2392 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 2 ms 2652 KB Output is correct
28 Correct 2 ms 2652 KB Output is correct
29 Correct 2 ms 2584 KB Output is correct
30 Correct 2 ms 2648 KB Output is correct
31 Correct 3 ms 2904 KB Output is correct
32 Correct 2 ms 2652 KB Output is correct
33 Correct 2 ms 2652 KB Output is correct
34 Correct 2 ms 2652 KB Output is correct
35 Correct 2 ms 2652 KB Output is correct
36 Correct 2 ms 2652 KB Output is correct
37 Correct 2 ms 2652 KB Output is correct
38 Correct 2 ms 2652 KB Output is correct
39 Correct 0 ms 2396 KB Output is correct
40 Correct 2 ms 2652 KB Output is correct
41 Correct 2 ms 2652 KB Output is correct
42 Correct 2 ms 2500 KB Output is correct
43 Correct 2 ms 2652 KB Output is correct
44 Correct 2 ms 2668 KB Output is correct
45 Correct 2 ms 2652 KB Output is correct
46 Correct 2 ms 2652 KB Output is correct
47 Correct 1 ms 2648 KB Output is correct
48 Correct 2 ms 2648 KB Output is correct
49 Correct 3 ms 2648 KB Output is correct
50 Correct 3 ms 2648 KB Output is correct
51 Correct 2 ms 2652 KB Output is correct
52 Correct 2 ms 2652 KB Output is correct
53 Correct 2 ms 2652 KB Output is correct
54 Correct 2 ms 2648 KB Output is correct
55 Correct 3 ms 2648 KB Output is correct
56 Correct 2 ms 2652 KB Output is correct
57 Correct 2 ms 2632 KB Output is correct
58 Correct 3 ms 2652 KB Output is correct
59 Correct 2 ms 2652 KB Output is correct
60 Correct 2 ms 2652 KB Output is correct
61 Correct 0 ms 2396 KB Output is correct
62 Correct 3 ms 2652 KB Output is correct
63 Correct 2 ms 2652 KB Output is correct
64 Correct 2 ms 2648 KB Output is correct
65 Correct 2 ms 2652 KB Output is correct
66 Correct 3 ms 2652 KB Output is correct
67 Correct 2 ms 2652 KB Output is correct
68 Correct 2 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 319 ms 21040 KB Output is correct
3 Correct 317 ms 21036 KB Output is correct
4 Correct 336 ms 21144 KB Output is correct
5 Correct 325 ms 21440 KB Output is correct
6 Correct 304 ms 20948 KB Output is correct
7 Correct 339 ms 21144 KB Output is correct
8 Correct 345 ms 21072 KB Output is correct
9 Correct 356 ms 21072 KB Output is correct
10 Correct 319 ms 21052 KB Output is correct
11 Correct 302 ms 21076 KB Output is correct
12 Correct 335 ms 21480 KB Output is correct
13 Correct 312 ms 21148 KB Output is correct
14 Correct 317 ms 21084 KB Output is correct
15 Correct 322 ms 21072 KB Output is correct
16 Correct 320 ms 20928 KB Output is correct
17 Correct 312 ms 21076 KB Output is correct
18 Correct 305 ms 21140 KB Output is correct
19 Correct 302 ms 21076 KB Output is correct
20 Correct 326 ms 21328 KB Output is correct
21 Correct 313 ms 21072 KB Output is correct
22 Correct 1 ms 2392 KB Output is correct
23 Correct 2 ms 2652 KB Output is correct
24 Correct 2 ms 2652 KB Output is correct
25 Correct 2 ms 2652 KB Output is correct
26 Correct 2 ms 2584 KB Output is correct
27 Correct 2 ms 2648 KB Output is correct
28 Correct 3 ms 2904 KB Output is correct
29 Correct 2 ms 2652 KB Output is correct
30 Correct 2 ms 2652 KB Output is correct
31 Correct 2 ms 2652 KB Output is correct
32 Correct 2 ms 2652 KB Output is correct
33 Correct 2 ms 2652 KB Output is correct
34 Correct 2 ms 2652 KB Output is correct
35 Correct 2 ms 2652 KB Output is correct
36 Correct 0 ms 2396 KB Output is correct
37 Correct 2 ms 2652 KB Output is correct
38 Correct 2 ms 2652 KB Output is correct
39 Correct 2 ms 2500 KB Output is correct
40 Correct 2 ms 2652 KB Output is correct
41 Correct 2 ms 2668 KB Output is correct
42 Correct 2 ms 2652 KB Output is correct
43 Correct 2 ms 2652 KB Output is correct
44 Correct 1 ms 2396 KB Output is correct
45 Correct 292 ms 21144 KB Output is correct
46 Correct 289 ms 21148 KB Output is correct
47 Correct 286 ms 21148 KB Output is correct
48 Correct 302 ms 21148 KB Output is correct
49 Correct 293 ms 21072 KB Output is correct
50 Correct 336 ms 21076 KB Output is correct
51 Correct 306 ms 21076 KB Output is correct
52 Correct 303 ms 21144 KB Output is correct
53 Correct 306 ms 21068 KB Output is correct
54 Correct 290 ms 21148 KB Output is correct
55 Correct 287 ms 21072 KB Output is correct
56 Correct 289 ms 20992 KB Output is correct
57 Correct 324 ms 21152 KB Output is correct
58 Correct 1 ms 2396 KB Output is correct
59 Correct 300 ms 21084 KB Output is correct
60 Correct 310 ms 21180 KB Output is correct
61 Correct 282 ms 21072 KB Output is correct
62 Correct 300 ms 21128 KB Output is correct
63 Correct 286 ms 21064 KB Output is correct
64 Correct 281 ms 21076 KB Output is correct
65 Correct 308 ms 21072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2408 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2500 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2548 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 386 ms 22112 KB Output is correct
27 Correct 389 ms 22092 KB Output is correct
28 Correct 390 ms 21948 KB Output is correct
29 Correct 397 ms 22076 KB Output is correct
30 Correct 410 ms 22084 KB Output is correct
31 Correct 377 ms 22000 KB Output is correct
32 Correct 388 ms 22100 KB Output is correct
33 Correct 398 ms 22100 KB Output is correct
34 Correct 388 ms 21956 KB Output is correct
35 Correct 414 ms 22104 KB Output is correct
36 Correct 397 ms 22100 KB Output is correct
37 Correct 397 ms 22356 KB Output is correct
38 Correct 393 ms 22100 KB Output is correct
39 Correct 373 ms 22356 KB Output is correct
40 Correct 379 ms 22044 KB Output is correct
41 Correct 366 ms 22100 KB Output is correct
42 Correct 380 ms 22012 KB Output is correct
43 Correct 402 ms 21932 KB Output is correct
44 Correct 389 ms 22100 KB Output is correct
45 Correct 376 ms 22076 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 319 ms 21040 KB Output is correct
48 Correct 317 ms 21036 KB Output is correct
49 Correct 336 ms 21144 KB Output is correct
50 Correct 325 ms 21440 KB Output is correct
51 Correct 304 ms 20948 KB Output is correct
52 Correct 339 ms 21144 KB Output is correct
53 Correct 345 ms 21072 KB Output is correct
54 Correct 356 ms 21072 KB Output is correct
55 Correct 319 ms 21052 KB Output is correct
56 Correct 302 ms 21076 KB Output is correct
57 Correct 335 ms 21480 KB Output is correct
58 Correct 312 ms 21148 KB Output is correct
59 Correct 317 ms 21084 KB Output is correct
60 Correct 322 ms 21072 KB Output is correct
61 Correct 320 ms 20928 KB Output is correct
62 Correct 312 ms 21076 KB Output is correct
63 Correct 305 ms 21140 KB Output is correct
64 Correct 302 ms 21076 KB Output is correct
65 Correct 326 ms 21328 KB Output is correct
66 Correct 313 ms 21072 KB Output is correct
67 Correct 1 ms 2392 KB Output is correct
68 Correct 2 ms 2652 KB Output is correct
69 Correct 2 ms 2652 KB Output is correct
70 Correct 2 ms 2652 KB Output is correct
71 Correct 2 ms 2584 KB Output is correct
72 Correct 2 ms 2648 KB Output is correct
73 Correct 3 ms 2904 KB Output is correct
74 Correct 2 ms 2652 KB Output is correct
75 Correct 2 ms 2652 KB Output is correct
76 Correct 2 ms 2652 KB Output is correct
77 Correct 2 ms 2652 KB Output is correct
78 Correct 2 ms 2652 KB Output is correct
79 Correct 2 ms 2652 KB Output is correct
80 Correct 2 ms 2652 KB Output is correct
81 Correct 0 ms 2396 KB Output is correct
82 Correct 2 ms 2652 KB Output is correct
83 Correct 2 ms 2652 KB Output is correct
84 Correct 2 ms 2500 KB Output is correct
85 Correct 2 ms 2652 KB Output is correct
86 Correct 2 ms 2668 KB Output is correct
87 Correct 2 ms 2652 KB Output is correct
88 Correct 2 ms 2652 KB Output is correct
89 Correct 1 ms 2648 KB Output is correct
90 Correct 2 ms 2648 KB Output is correct
91 Correct 3 ms 2648 KB Output is correct
92 Correct 3 ms 2648 KB Output is correct
93 Correct 2 ms 2652 KB Output is correct
94 Correct 2 ms 2652 KB Output is correct
95 Correct 2 ms 2652 KB Output is correct
96 Correct 2 ms 2648 KB Output is correct
97 Correct 3 ms 2648 KB Output is correct
98 Correct 2 ms 2652 KB Output is correct
99 Correct 2 ms 2632 KB Output is correct
100 Correct 3 ms 2652 KB Output is correct
101 Correct 2 ms 2652 KB Output is correct
102 Correct 2 ms 2652 KB Output is correct
103 Correct 0 ms 2396 KB Output is correct
104 Correct 3 ms 2652 KB Output is correct
105 Correct 2 ms 2652 KB Output is correct
106 Correct 2 ms 2648 KB Output is correct
107 Correct 2 ms 2652 KB Output is correct
108 Correct 3 ms 2652 KB Output is correct
109 Correct 2 ms 2652 KB Output is correct
110 Correct 2 ms 2652 KB Output is correct
111 Correct 1 ms 2396 KB Output is correct
112 Correct 292 ms 21144 KB Output is correct
113 Correct 289 ms 21148 KB Output is correct
114 Correct 286 ms 21148 KB Output is correct
115 Correct 302 ms 21148 KB Output is correct
116 Correct 293 ms 21072 KB Output is correct
117 Correct 336 ms 21076 KB Output is correct
118 Correct 306 ms 21076 KB Output is correct
119 Correct 303 ms 21144 KB Output is correct
120 Correct 306 ms 21068 KB Output is correct
121 Correct 290 ms 21148 KB Output is correct
122 Correct 287 ms 21072 KB Output is correct
123 Correct 289 ms 20992 KB Output is correct
124 Correct 324 ms 21152 KB Output is correct
125 Correct 1 ms 2396 KB Output is correct
126 Correct 300 ms 21084 KB Output is correct
127 Correct 310 ms 21180 KB Output is correct
128 Correct 282 ms 21072 KB Output is correct
129 Correct 300 ms 21128 KB Output is correct
130 Correct 286 ms 21064 KB Output is correct
131 Correct 281 ms 21076 KB Output is correct
132 Correct 308 ms 21072 KB Output is correct
133 Correct 1 ms 2392 KB Output is correct
134 Correct 345 ms 22108 KB Output is correct
135 Correct 314 ms 22104 KB Output is correct
136 Correct 331 ms 22112 KB Output is correct
137 Correct 321 ms 22100 KB Output is correct
138 Correct 301 ms 22096 KB Output is correct
139 Correct 310 ms 22356 KB Output is correct
140 Correct 305 ms 22096 KB Output is correct
141 Correct 301 ms 22100 KB Output is correct
142 Correct 306 ms 21980 KB Output is correct
143 Correct 306 ms 22100 KB Output is correct
144 Correct 322 ms 22092 KB Output is correct
145 Correct 302 ms 22096 KB Output is correct
146 Correct 304 ms 22356 KB Output is correct
147 Correct 1 ms 2392 KB Output is correct
148 Correct 311 ms 21928 KB Output is correct
149 Correct 289 ms 22100 KB Output is correct
150 Correct 298 ms 22100 KB Output is correct
151 Correct 301 ms 21952 KB Output is correct
152 Correct 314 ms 22072 KB Output is correct
153 Correct 301 ms 21876 KB Output is correct
154 Correct 321 ms 22136 KB Output is correct