Submission #693679

#TimeUsernameProblemLanguageResultExecution timeMemory
693679zeroesandonesCryptography (NOI20_crypto)C++17
11 / 100
33 ms4584 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]; ll k = a[0]; ll ans = 0; ans = (((k - 1) * factorial(n - 1)) % mod + 1) % mod; 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...