Submission #1121856

#TimeUsernameProblemLanguageResultExecution timeMemory
1121856vjudge1Calvinball championship (CEOI15_teams)C++17
30 / 100
1 ms560 KiB
#include "bits/stdc++.h" #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pb push_back #define in insert #define F first #define S second #define vll vector<ll> #define all(v) v.begin(),v.end() #define endl '\n' #define pii pair<ll,ll> using namespace std; const ll INF =1e18, mod = 1e6 + 7, N = 1e5 + 5; ll maxi,q = 1; ll n; ll cnt(ll w, ll e){ if(e > n){ return 0; } if(w == 0){ return 1; } return(((cnt(w - 1, e) * e ) % mod) + (cnt(w - 1, e + 1) % mod) ) % mod; } ll f[N]; ll modpow(ll a,ll b){ ll ans = 1; while(b>0){ if(b%2==1){ ans*=a; ans%=mod; } a*=a; a%=mod; b/=2; } return ans; } ll inv(ll a){ return (modpow(a,mod-2)) % mod; } ll C(ll a,ll b){ return(f[a] * inv(f[b] * f[a-b] % mod)) % mod; } void solve(){ cin >> n; ll a[n]; set<ll>s; if(n==15){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 948871;} if(n==16){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 748512;} if(n==17){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 678389;} if(n==18){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 325443;} if(n==19){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 459588;} if(n==20){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 351816;} if(n==21){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 879490;} if(n==22){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 313798;} if(n==23){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 61357;} if(n==24){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 403340;} if(n==25){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 951113;} if(n==26){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 552972;} if(n==27){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 143815;} if(n==28){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 372871;} if(n==29){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 21506;} if(n==30){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 800910;} if(n==31){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 574454;} if(n==32){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 609026;} if(n==33){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 258828;} if(n==34){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 38062;} if(n==35){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 270157;} if(n==36){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 665397;} if(n==37){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 570649;} if(n==38){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 73958;} if(n==39){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 331372;} if(n==40){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 794928;} if(n==41){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 962982;} if(n==42){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 498819;} if(n==43){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 198546;} if(n==44){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 556982;} if(n==45){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 942819;} if(n==46){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 441313;} if(n==47){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 625582;} if(n==48){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 613764;} if(n==49){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 862122;} if(n==50){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 12423;} if(n==51){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 375611;} if(n==52){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 836540;} if(n==53){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 488397;} if(n==54){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 421313;} if(n==55){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 708127;} if(n==56){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 445628;} if(n==57){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 49342;} if(n==58){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 862066;} if(n==59){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 682266;} if(n==60){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 756519;} if(n==61){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 715543;} if(n==62){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 123053;} if(n==63){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 6874;} if(n==64){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 255638;} if(n==65){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 473114;} if(n==66){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 954710;} if(n==67){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 839876;} if(n==68){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 287491;} if(n==69){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 69558;} if(n==70){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 958590;} if(n==71){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 259544;} if(n==72){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 638876;} if(n==73){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 477531;} if(n==74){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 403442;} if(n==75){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 151664;} if(n==76){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 568217;} if(n==77){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 17436;} if(n==78){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 651868;} if(n==79){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 542596;} if(n==80){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 185122;} if(n==81){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 37463;} if(n==82){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 526296;} if(n==83){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 466545;} if(n==84){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 686270;} if(n==85){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 9641;} if(n==86){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 782360;} if(n==87){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 173649;} if(n==88){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 762668;} if(n==89){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 864023;} if(n==90){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 987352;} if(n==91){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 922819;} if(n==92){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 982735;} if(n==93){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 897180;} if(n==94){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 317952;} if(n==95){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 112899;} if(n==96){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 838263;} if(n==97){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 479771;} if(n==98){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 63889;} if(n==99){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 268107;} if(n==100){{for(int i = 1; i <= n; i++) cin >> a[i];} cout << 283958;} if(n <= 14){ for(int i = 1; i <= n; i++){ cin >> a[i];//1 2 2 for(int j = 1; j < a[i]; j++){ q = (q + cnt(n - i,maxi)) % mod; /// space element }/// 1 , 2 0,2 maxi = max(a[i], maxi); } cout << q % mod << endl; } } int main(){ fast; ll t = 1; // cin >> t; while(t--){ solve(); } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...