제출 #693675

#제출 시각아이디문제언어결과실행 시간메모리
693675zeroesandonesCryptography (NOI20_crypto)C++17
15 / 100
34 ms5556 KiB
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vi; typedef pair<ll, ll> pi; #define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i) #define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i) #define nl "\n" #define sp " " #define all(x) (x).begin(), (x).end() #define sc second #define fr first #define pb emplace_back const int mod = 1e9 + 7; ll add(ll x, ll y) { return (x % mod + y % mod) % mod; } ll factorial(ll n) { ll res = 1; while(n) { res *= n; res %= mod; --n; } return (res % mod); } void solve() { ll n; cin >> n; vi a(n); FOR(i, 0, n) cin >> a[i]; bool increasing = true; FOR(i, 1, n) { if(a[i] < a[i - 1]) { increasing = false; break; } } ll ans = 0; if(increasing) { ans = 1; } else { ans = factorial(n); } cout << ans << nl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll t = 1; // cin >> t; while (t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...