# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
577156 | 2022-06-14T08:03:45 Z | Ronin13 | Zoltan (COCI16_zoltan) | C++14 | 1000 ms | 4588 KB |
#include<bits/stdc++.h> #define ll long long #define f first #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define epb emplace_back #define ull unsigned ll using namespace std; const ll mod = 1e9 + 7; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int a[n + 1]; for(int i = 1; i <= n; i++){ cin >> a[i]; } deque <int> q; q.push_front(a[1]); for(int i = 2; i <= n; i++){ if(a[i] > q.front()) q.push_back(a[i]); else q.push_front(a[i]); } int b[n + 1]; int ind = 0; while(!q.empty()){ int v = q.front(); q.pop_front(); b[ind++] = v; } ll cnt = 0; int mx = 0; for(int i = 0; i < (1 << n); i++){ vector <int> vec; for(int j = 0; j < n; j++) if((1 << j) & i) vec.pb(b[j]); int ind = false; for(int i = 1; i < vec.size(); i++){ if(vec[i] <= vec[i - 1]){ ind = true; break; } } if(!ind){ mx = max(mx, (int)vec.size()); } } for(int i = 0; i < (1 << n); i++){ if(__builtin_popcount(i) != mx) continue; vector <int> vec; for(int j = 0; j < n; j++) if((1 << j) & i) vec.pb(b[j]); int ind = false; for(int i = 1; i < vec.size(); i++){ if(vec[i] <= vec[i - 1]){ ind = true; break; } } if(!ind){ cnt++; } } for(int i = 1; i <= n - mx; i++) cnt *= 2, cnt %= mod; cout << mx << ' ' << cnt << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 235 ms | 304 KB | Output isn't correct |
2 | Incorrect | 244 ms | 296 KB | Output isn't correct |
3 | Incorrect | 228 ms | 300 KB | Output isn't correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 215 ms | 296 KB | Output is correct |
6 | Correct | 223 ms | 332 KB | Output is correct |
7 | Incorrect | 1 ms | 328 KB | Output isn't correct |
8 | Incorrect | 1 ms | 340 KB | Output isn't correct |
9 | Incorrect | 1 ms | 324 KB | Output isn't correct |
10 | Incorrect | 1 ms | 212 KB | Output isn't correct |
11 | Incorrect | 20 ms | 3396 KB | Output isn't correct |
12 | Execution timed out | 1080 ms | 3272 KB | Time limit exceeded |
13 | Incorrect | 17 ms | 2716 KB | Output isn't correct |
14 | Incorrect | 49 ms | 3416 KB | Output isn't correct |
15 | Execution timed out | 1080 ms | 3908 KB | Time limit exceeded |
16 | Incorrect | 46 ms | 4588 KB | Output isn't correct |
17 | Incorrect | 19 ms | 3896 KB | Output isn't correct |
18 | Incorrect | 19 ms | 3888 KB | Output isn't correct |
19 | Incorrect | 21 ms | 3872 KB | Output isn't correct |
20 | Incorrect | 27 ms | 3896 KB | Output isn't correct |