Submission #1121649

#TimeUsernameProblemLanguageResultExecution timeMemory
1121649rahidilbayramliCalvinball championship (CEOI15_teams)C++17
0 / 100
2 ms592 KiB
#pragma GCC optimize("-O3") #include<bits/stdc++.h> #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define sz(v) (ll)(v.size()) #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; const ll mod = 1e6+7; void solve() { ll n, i; cin >> n; ll a[n+5], cnt = 0; for(i = 1; i <= n; i++){ cin >> a[i]; if(a[i] == i) cnt++; } if(cnt == n) { ll f[n+5]; f[1] = 1; f[2] = 2; ll g = 1; for(i = 3; i <= n; i++){ f[i] = f[i-1] * 2 + g; g += 2; f[i] %= mod; } cout << f[n] << "\n"; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll tests = 1; //cin >> tests; while(tests--) { solve(); } } /* 5 5 1 2 3 4 5 2 3 5 4 3 3 5 1 2 5 2 1 3 3 1 1 3 */
#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...