Submission #1113805

#TimeUsernameProblemLanguageResultExecution timeMemory
1113805AvianshCryptography (NOI20_crypto)C++17
14 / 100
205 ms32328 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; int fac[100005]; int mod = 1e9+7; signed main(){ ios::sync_with_stdio(0); cin.tie(0); fac[1]=1; for(int i = 2;i<=1e5;i++){ fac[i]=fac[i-1]*i; fac[i]%=mod; } int n; cin >> n; int arr[n]; ordered_set pts; for(int &i : arr){ cin >> i; pts.insert(i); } long long ans = 0; for(int i = 0;i<n;i++){ ans+=1LL*pts.order_of_key(arr[i])*fac[n-i-1]; ans%=mod; pts.erase(arr[i]); } ans++; cout << ans; return 0; }
#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...