# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121940 | vjudge1 | Calvinball championship (CEOI15_teams) | C++17 | 66 ms | 65536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
██╗░░██╗████████╗██╗░░░░░███╗░░░███╗
██║░░██║╚══██╔══╝██║░░░░░████╗░████║
███████║░░░██║░░░██║░░░░░██╔████╔██║
██╔══██║░░░██║░░░██║░░░░░██║╚██╔╝██║
██║░░██║░░░██║░░░███████╗██║░╚═╝░██║
╚═╝░░╚═╝░░░╚═╝░░░╚══════╝╚═╝░░░░░╚═╝
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define int l
#define f first
#define stop system("pause")
#define ara <<" "<<
#define s second
#define endl '\n'
#define l long long
#define pb push_back
#define pairs pair<l,l>
#define all(v) v.begin(),v.end()
#define yesno(v) ((v) ? "YES" : "NO")
#define dbg(x) cout<<#x<<" = "<<x<<endl;
#define filereader() ifstream cin(input);
#define fileprinter() ofstream cout(output);
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int> , rb_tree_tag, tree_order_statistics_node_update> indexed_set;
l gcd(l a, l b){
return (b == 0) ? a : gcd(b, a%b);
}
const l N = 1e4 + 5;
const l INF = 1e18;
const l mod = 1e6 + 7;
const string input = "input.txt";
const string output = "output.txt";
l dp[N][N];
void solve(){
//ifstream cin(input);
//ofstream cout(output);
l n;
cin >> n;
l a[n];
//set<l>s;
for(int i = 0 ; i < n ; i++){
cin>>a[i];a[i]--;
}
dp[0][0] = 1;
for(int i = 1; i <= n ; i++){
for(int j = 1; j <= n; j++){
dp[i][j] = ((dp[i-1][j] * (j)) % mod + dp[i-1][j-1]) % mod;
}
}
/*
3
0 1 1
*/
l ans = 0;
for(int i = 1 ; i <= n ; i++){
ans = (ans + dp[n][i]) % mod;
}
cout<<ans<<endl;
}
signed main(){
//fast;
system("color a");
l n = 1;
//cin>>n;
while(n--){
solve();
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |