Submission #1121756

#TimeUsernameProblemLanguageResultExecution timeMemory
1121756vjudge1Calvinball championship (CEOI15_teams)C++17
0 / 100
2 ms848 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define run ios_base::sync_with_stdio(false);cin.tie(0); #define ll long long #define pll pair<ll, ll> #define ull unsigned ll #define ld double #define endl "\n" #define pb push_back #define fi first #define se second #define pi acos(-1) #define N 100007 #define minimum -9223372036854775807 #define maximum -minimum #define mod 1000000007 using namespace std; using namespace __gnu_pbds; template <class t> using ordered_set=tree<t, null_type,less_equal<t>, rb_tree_tag,tree_order_statistics_node_update>; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ll gcd(ll a, ll b) { if(b==0) return a; return gcd(b, a%b); } ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } bool isprime(ll n) { if(n==1) return 0; for(ll i=2; i*i<=n; i++) { if(n%i==0) return 0; } return 1; } ll binpow(ll a, ll b) { a%=mod; ll res=1; while(b>0) { if(b%2==1) res=(res*a)%mod; a=(a*a)%mod; b/=2; } return res; } ll dp[N]; const int modd=1000007; int main() { run; ll n; cin>>n; ll a[n+1]; for(ll i=1; i<=n; i++) { cin>>a[i]; } dp[1]=1; ll pref[n+1]; pref[1]=1; for(ll i=2; i<=n; i++) { dp[i]=pref[i-1]+dp[i-1]%modd; pref[i]=pref[i-1]+dp[i]; pref[i]%=modd; } cout<<dp[n]%modd<<endl; } /* 1 - 1 2 - 2 3 - 5 4 - 13 5 - 34 1 1 1 2 1 1 1 1 2 2 3 1 1 1 1 1 1 2 2 1 2 1 3 1 2 2 4 1 2 3 5 4 1 1 1 1 1 1 1 1 2 2 1 1 2 1 3 1 1 2 2 4 1 1 2 3 5 1 2 1 1 6 1 2 1 2 7 1 2 2 1 8 1 2 2 2 9 1 2 2 3 10 1 2 3 2 11 1 2 3 3 12 1 2 3 4 13 5 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 2 1 3 1 1 1 2 2 4 1 1 1 2 3 5 1 1 2 1 1 6 1 1 2 1 2 7 1 1 2 2 1 8 1 1 2 2 2 9 1 1 2 2 3 10 1 1 2 3 2 11 1 1 2 3 3 12 1 1 2 3 4 13 1 2 1 1 1 14 1 2 1 1 2 15 1 2 1 2 1 16 1 2 1 2 2 17 1 2 1 2 3 18 1 2 2 1 1 19 1 2 2 1 2 20 1 2 2 2 1 21 1 2 2 2 2 22 1 2 2 2 3 23 1 2 2 3 2 24 1 2 2 3 3 25 1 2 2 3 4 26 1 2 3 2 1 27 1 2 3 2 2 28 1 2 3 2 3 29 1 2 3 3 2 30 1 2 3 3 3 31 1 2 3 3 4 32 1 2 3 4 4 33 1 2 3 4 5 34 */ // By Xanlar
#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...