답안 #693704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
693704 2023-02-03T07:16:40 Z saayan007 Cryptography (NOI20_crypto) C++17
15 / 100
36 ms 7432 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vpi = vector<pi>;
using vpl = vector<pl>;

#define fur(i, a, b) for(ll i = a; i <= (ll) b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll) b; --i)
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define nl "\n"

const ll mod = 1e9L + 7;
const ll mxn = 3e5L + 5;

ll n;
pl p[mxn];

ll mul(const ll &a, const ll &b) {
    ll c = (a % mod) * (b % mod);
    c %= mod;
    if(c < 0)
        c += mod;
    return c;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    fur(i, 1, n) {
        cin >> p[i].fr;
        p[i].sc = i;
    }
    sort(p + 1, p + n + 1);
    ll a[n + 1];
    fur(i, 1, n) {
        a[p[i].sc] = i;
    }

    ll res = 1;
    if(a[1] > a[2]) {
        fur(i, 1, n) {
            res = mul(res, i);
        }
    }
    cout << res << nl;
}
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 36 ms 7304 KB Output is correct
3 Correct 36 ms 7236 KB Output is correct
4 Correct 33 ms 7252 KB Output is correct
5 Correct 33 ms 7328 KB Output is correct
6 Correct 33 ms 7432 KB Output is correct
7 Correct 36 ms 7300 KB Output is correct
8 Correct 32 ms 7268 KB Output is correct
9 Correct 32 ms 7244 KB Output is correct
10 Correct 34 ms 7372 KB Output is correct
11 Correct 32 ms 7244 KB Output is correct
12 Correct 32 ms 7284 KB Output is correct
13 Correct 34 ms 7260 KB Output is correct
14 Correct 33 ms 7320 KB Output is correct
15 Correct 35 ms 7220 KB Output is correct
16 Correct 34 ms 7256 KB Output is correct
17 Correct 33 ms 7248 KB Output is correct
18 Correct 33 ms 7312 KB Output is correct
19 Correct 36 ms 7248 KB Output is correct
20 Correct 33 ms 7296 KB Output is correct
21 Correct 35 ms 7324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 28 ms 7300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
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 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 28 ms 7300 KB Output isn't correct
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 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -