# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
733877 | 2023-05-01T11:29:36 Z | vjudge1 | Cryptography (NOI20_crypto) | C++17 | 1000 ms | 4952 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long const ll d = 1e9 + 7; ll ft(ll n) { ll ans = 1; for(ll i = 2; i <= n; i++) { ans *= i; ans %= d; } return ans; } int main() { ll n; cin >> n; vector <ll> v(n), v1; for(ll i = 0; i < n; i++) { cin >> v[i]; } v1 = v; ll ans = 1; sort(v1.begin(), v1.end()); if(v == v1) { cout << 1; return 0; } reverse(v1.begin(), v1.end()); if(v1 == v) { cout << n; return 0; } else reverse(v1.begin(), v1.end()); for(ll i = 0; i < v.size(); i++) { for(ll j = 0; j < v1.size(); j++) { if(v[i] == v1[j]) { n--; ans += ft(n) * j; ans %= d; auto it = v1.begin() + j; auto it1 = v.begin() + i; v1.erase(it); v.erase(it1); i--; j--; break; } } } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Incorrect | 1 ms | 212 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 110 ms | 4952 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Execution timed out | 1073 ms | 4952 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 25 ms | 340 KB | Output is correct |
3 | Correct | 25 ms | 212 KB | Output is correct |
4 | Correct | 26 ms | 348 KB | Output is correct |
5 | Correct | 25 ms | 348 KB | Output is correct |
6 | Correct | 24 ms | 344 KB | Output is correct |
7 | Correct | 24 ms | 344 KB | Output is correct |
8 | Correct | 25 ms | 340 KB | Output is correct |
9 | Correct | 24 ms | 212 KB | Output is correct |
10 | Correct | 28 ms | 344 KB | Output is correct |
11 | Correct | 25 ms | 340 KB | Output is correct |
12 | Correct | 24 ms | 340 KB | Output is correct |
13 | Correct | 25 ms | 212 KB | Output is correct |
14 | Correct | 24 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 25 ms | 340 KB | Output is correct |
17 | Correct | 24 ms | 340 KB | Output is correct |
18 | Correct | 24 ms | 348 KB | Output is correct |
19 | Correct | 25 ms | 344 KB | Output is correct |
20 | Correct | 25 ms | 340 KB | Output is correct |
21 | Correct | 24 ms | 340 KB | Output is correct |
22 | Correct | 24 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Incorrect | 1 ms | 212 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Execution timed out | 1073 ms | 4952 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Incorrect | 1 ms | 212 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |