답안 #888907

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
888907 2023-12-18T11:30:43 Z vjudge1 Cryptography (NOI20_crypto) C++17
100 / 100
411 ms 19580 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 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 2392 KB Output is correct
13 Correct 1 ms 2396 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 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 391 ms 19168 KB Output is correct
3 Correct 397 ms 19028 KB Output is correct
4 Correct 378 ms 19412 KB Output is correct
5 Correct 407 ms 19028 KB Output is correct
6 Correct 409 ms 19200 KB Output is correct
7 Correct 364 ms 19028 KB Output is correct
8 Correct 386 ms 19436 KB Output is correct
9 Correct 386 ms 19196 KB Output is correct
10 Correct 383 ms 19580 KB Output is correct
11 Correct 389 ms 19028 KB Output is correct
12 Correct 406 ms 18996 KB Output is correct
13 Correct 389 ms 19200 KB Output is correct
14 Correct 411 ms 19284 KB Output is correct
15 Correct 390 ms 19168 KB Output is correct
16 Correct 388 ms 19108 KB Output is correct
17 Correct 374 ms 19204 KB Output is correct
18 Correct 385 ms 19280 KB Output is correct
19 Correct 389 ms 19072 KB Output is correct
20 Correct 387 ms 19064 KB Output is correct
21 Correct 394 ms 19012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 320 ms 19064 KB Output is correct
3 Correct 321 ms 19160 KB Output is correct
4 Correct 338 ms 19068 KB Output is correct
5 Correct 313 ms 19184 KB Output is correct
6 Correct 313 ms 19260 KB Output is correct
7 Correct 334 ms 19016 KB Output is correct
8 Correct 344 ms 19072 KB Output is correct
9 Correct 369 ms 19100 KB Output is correct
10 Correct 330 ms 19424 KB Output is correct
11 Correct 309 ms 19204 KB Output is correct
12 Correct 319 ms 19184 KB Output is correct
13 Correct 312 ms 19176 KB Output is correct
14 Correct 305 ms 19204 KB Output is correct
15 Correct 335 ms 19456 KB Output is correct
16 Correct 310 ms 19028 KB Output is correct
17 Correct 309 ms 19400 KB Output is correct
18 Correct 302 ms 19028 KB Output is correct
19 Correct 310 ms 19176 KB Output is correct
20 Correct 319 ms 19140 KB Output is correct
21 Correct 307 ms 19080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 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 2652 KB Output is correct
6 Correct 2 ms 2652 KB Output is correct
7 Correct 2 ms 2648 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 2652 KB Output is correct
19 Correct 2 ms 2904 KB Output is correct
20 Correct 2 ms 2652 KB Output is correct
21 Correct 2 ms 2652 KB Output is correct
22 Correct 2 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 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 2392 KB Output is correct
13 Correct 1 ms 2396 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 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 0 ms 2396 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 2652 KB Output is correct
30 Correct 2 ms 2652 KB Output is correct
31 Correct 2 ms 2648 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 2652 KB Output is correct
43 Correct 2 ms 2904 KB Output is correct
44 Correct 2 ms 2652 KB Output is correct
45 Correct 2 ms 2652 KB Output is correct
46 Correct 2 ms 2652 KB Output is correct
47 Correct 0 ms 2392 KB Output is correct
48 Correct 2 ms 2408 KB Output is correct
49 Correct 3 ms 2648 KB Output is correct
50 Correct 2 ms 2652 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 2652 KB Output is correct
55 Correct 2 ms 2532 KB Output is correct
56 Correct 2 ms 2652 KB Output is correct
57 Correct 2 ms 2652 KB Output is correct
58 Correct 2 ms 2656 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 2 ms 2652 KB Output is correct
63 Correct 2 ms 2652 KB Output is correct
64 Correct 2 ms 2652 KB Output is correct
65 Correct 2 ms 2652 KB Output is correct
66 Correct 2 ms 2652 KB Output is correct
67 Correct 3 ms 2652 KB Output is correct
68 Correct 2 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 320 ms 19064 KB Output is correct
3 Correct 321 ms 19160 KB Output is correct
4 Correct 338 ms 19068 KB Output is correct
5 Correct 313 ms 19184 KB Output is correct
6 Correct 313 ms 19260 KB Output is correct
7 Correct 334 ms 19016 KB Output is correct
8 Correct 344 ms 19072 KB Output is correct
9 Correct 369 ms 19100 KB Output is correct
10 Correct 330 ms 19424 KB Output is correct
11 Correct 309 ms 19204 KB Output is correct
12 Correct 319 ms 19184 KB Output is correct
13 Correct 312 ms 19176 KB Output is correct
14 Correct 305 ms 19204 KB Output is correct
15 Correct 335 ms 19456 KB Output is correct
16 Correct 310 ms 19028 KB Output is correct
17 Correct 309 ms 19400 KB Output is correct
18 Correct 302 ms 19028 KB Output is correct
19 Correct 310 ms 19176 KB Output is correct
20 Correct 319 ms 19140 KB Output is correct
21 Correct 307 ms 19080 KB Output is correct
22 Correct 0 ms 2396 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 2652 KB Output is correct
27 Correct 2 ms 2652 KB Output is correct
28 Correct 2 ms 2648 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 2652 KB Output is correct
40 Correct 2 ms 2904 KB Output is correct
41 Correct 2 ms 2652 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 284 ms 19112 KB Output is correct
46 Correct 292 ms 19200 KB Output is correct
47 Correct 302 ms 19024 KB Output is correct
48 Correct 293 ms 19204 KB Output is correct
49 Correct 294 ms 19284 KB Output is correct
50 Correct 289 ms 19056 KB Output is correct
51 Correct 280 ms 19028 KB Output is correct
52 Correct 301 ms 19200 KB Output is correct
53 Correct 292 ms 19168 KB Output is correct
54 Correct 305 ms 19492 KB Output is correct
55 Correct 285 ms 19028 KB Output is correct
56 Correct 295 ms 19280 KB Output is correct
57 Correct 288 ms 19024 KB Output is correct
58 Correct 1 ms 2396 KB Output is correct
59 Correct 288 ms 19196 KB Output is correct
60 Correct 309 ms 19028 KB Output is correct
61 Correct 286 ms 19200 KB Output is correct
62 Correct 307 ms 19108 KB Output is correct
63 Correct 269 ms 19152 KB Output is correct
64 Correct 290 ms 19204 KB Output is correct
65 Correct 277 ms 19024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 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 2392 KB Output is correct
13 Correct 1 ms 2396 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 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 391 ms 19168 KB Output is correct
27 Correct 397 ms 19028 KB Output is correct
28 Correct 378 ms 19412 KB Output is correct
29 Correct 407 ms 19028 KB Output is correct
30 Correct 409 ms 19200 KB Output is correct
31 Correct 364 ms 19028 KB Output is correct
32 Correct 386 ms 19436 KB Output is correct
33 Correct 386 ms 19196 KB Output is correct
34 Correct 383 ms 19580 KB Output is correct
35 Correct 389 ms 19028 KB Output is correct
36 Correct 406 ms 18996 KB Output is correct
37 Correct 389 ms 19200 KB Output is correct
38 Correct 411 ms 19284 KB Output is correct
39 Correct 390 ms 19168 KB Output is correct
40 Correct 388 ms 19108 KB Output is correct
41 Correct 374 ms 19204 KB Output is correct
42 Correct 385 ms 19280 KB Output is correct
43 Correct 389 ms 19072 KB Output is correct
44 Correct 387 ms 19064 KB Output is correct
45 Correct 394 ms 19012 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 320 ms 19064 KB Output is correct
48 Correct 321 ms 19160 KB Output is correct
49 Correct 338 ms 19068 KB Output is correct
50 Correct 313 ms 19184 KB Output is correct
51 Correct 313 ms 19260 KB Output is correct
52 Correct 334 ms 19016 KB Output is correct
53 Correct 344 ms 19072 KB Output is correct
54 Correct 369 ms 19100 KB Output is correct
55 Correct 330 ms 19424 KB Output is correct
56 Correct 309 ms 19204 KB Output is correct
57 Correct 319 ms 19184 KB Output is correct
58 Correct 312 ms 19176 KB Output is correct
59 Correct 305 ms 19204 KB Output is correct
60 Correct 335 ms 19456 KB Output is correct
61 Correct 310 ms 19028 KB Output is correct
62 Correct 309 ms 19400 KB Output is correct
63 Correct 302 ms 19028 KB Output is correct
64 Correct 310 ms 19176 KB Output is correct
65 Correct 319 ms 19140 KB Output is correct
66 Correct 307 ms 19080 KB Output is correct
67 Correct 0 ms 2396 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 2652 KB Output is correct
72 Correct 2 ms 2652 KB Output is correct
73 Correct 2 ms 2648 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 2652 KB Output is correct
85 Correct 2 ms 2904 KB Output is correct
86 Correct 2 ms 2652 KB Output is correct
87 Correct 2 ms 2652 KB Output is correct
88 Correct 2 ms 2652 KB Output is correct
89 Correct 0 ms 2392 KB Output is correct
90 Correct 2 ms 2408 KB Output is correct
91 Correct 3 ms 2648 KB Output is correct
92 Correct 2 ms 2652 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 2652 KB Output is correct
97 Correct 2 ms 2532 KB Output is correct
98 Correct 2 ms 2652 KB Output is correct
99 Correct 2 ms 2652 KB Output is correct
100 Correct 2 ms 2656 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 2 ms 2652 KB Output is correct
105 Correct 2 ms 2652 KB Output is correct
106 Correct 2 ms 2652 KB Output is correct
107 Correct 2 ms 2652 KB Output is correct
108 Correct 2 ms 2652 KB Output is correct
109 Correct 3 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 284 ms 19112 KB Output is correct
113 Correct 292 ms 19200 KB Output is correct
114 Correct 302 ms 19024 KB Output is correct
115 Correct 293 ms 19204 KB Output is correct
116 Correct 294 ms 19284 KB Output is correct
117 Correct 289 ms 19056 KB Output is correct
118 Correct 280 ms 19028 KB Output is correct
119 Correct 301 ms 19200 KB Output is correct
120 Correct 292 ms 19168 KB Output is correct
121 Correct 305 ms 19492 KB Output is correct
122 Correct 285 ms 19028 KB Output is correct
123 Correct 295 ms 19280 KB Output is correct
124 Correct 288 ms 19024 KB Output is correct
125 Correct 1 ms 2396 KB Output is correct
126 Correct 288 ms 19196 KB Output is correct
127 Correct 309 ms 19028 KB Output is correct
128 Correct 286 ms 19200 KB Output is correct
129 Correct 307 ms 19108 KB Output is correct
130 Correct 269 ms 19152 KB Output is correct
131 Correct 290 ms 19204 KB Output is correct
132 Correct 277 ms 19024 KB Output is correct
133 Correct 0 ms 2392 KB Output is correct
134 Correct 315 ms 19324 KB Output is correct
135 Correct 344 ms 18972 KB Output is correct
136 Correct 306 ms 19028 KB Output is correct
137 Correct 304 ms 19204 KB Output is correct
138 Correct 298 ms 19200 KB Output is correct
139 Correct 318 ms 19028 KB Output is correct
140 Correct 310 ms 19196 KB Output is correct
141 Correct 307 ms 19028 KB Output is correct
142 Correct 295 ms 19152 KB Output is correct
143 Correct 303 ms 19024 KB Output is correct
144 Correct 310 ms 19448 KB Output is correct
145 Correct 306 ms 19016 KB Output is correct
146 Correct 327 ms 19360 KB Output is correct
147 Correct 1 ms 2392 KB Output is correct
148 Correct 303 ms 19060 KB Output is correct
149 Correct 316 ms 19432 KB Output is correct
150 Correct 326 ms 19028 KB Output is correct
151 Correct 310 ms 19200 KB Output is correct
152 Correct 304 ms 18968 KB Output is correct
153 Correct 315 ms 19024 KB Output is correct
154 Correct 319 ms 19272 KB Output is correct