# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
49084 |
2018-05-22T01:19:59 Z |
ami |
Dojave (COCI17_dojave) |
C++14 |
|
4000 ms |
8940 KB |
#include <bits/stdc++.h>
#define sz(c) int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
#define bin(x) bitset<4>(x)
using namespace std;
using i64 = long long;
int const MAXN=1<<21;
int n;
int a[MAXN];
int p[MAXN];
int main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
cout<<fixed<<setprecision(10);
cin>>n;
rep(i,0,1<<n) cin>>a[i];
int N=1<<n;
rep(i,0,1<<n) p[N-1-a[i]]=i;
int res=N*(N+1)/2;
rep(i,0,N) {
rep(j,i+1,N) if ((j-i+1)%4==0) {
bool ok=true;
rep(k,i,j+1) if (p[a[k]]<i || p[a[k]]>j) {
ok=false;
break;
}
if (ok) { res-=1; }
}
}
cout<<res<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
424 KB |
Output is correct |
2 |
Correct |
3 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
670 ms |
588 KB |
Output is correct |
2 |
Correct |
53 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4030 ms |
604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
788 KB |
Output is correct |
2 |
Execution timed out |
4056 ms |
800 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2029 ms |
1320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2073 ms |
1320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4056 ms |
2752 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4022 ms |
8940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4064 ms |
8940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |