# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
856144 |
2023-10-02T17:36:35 Z |
vjudge1 |
Turnir (COCI17_turnir) |
C++17 |
|
511 ms |
23468 KB |
#include <bits/stdc++.h>
using namespace std;
#define sp << " " <<
#define int long long
#define vi vector<int>
#define pb push_back
#define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++)
#define pii pair<int,int>
#define all(x) x.begin()+1,x.end()
void solve() {
int n;
cin >> n;
int N = n;
n = 1;
F(i,N) n*=2;
vi a(n+1);
F(i,n) cin >> a[i];
vi b(n+1);
F(i,n) b[i] = a[i];
sort(b.begin()+1,b.end());
for (int i=1;i<=n;i++) {
int x= a[i];
int l = 1;
int r = n;
while (l<=r) {
int m = (l+r) >> 1;
if (b[m] <= x) l = m+1;
else r = m-1;
}
int ans = N;
for (int j=1;j<=N;j++) if (r >= (1<<j)-1) ans = N-j;
cout << ans << " ";
}
cout << endl;
}
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t = 1;
//cin >> t;
while (t --> 0) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Incorrect |
11 ms |
860 KB |
Output isn't correct |
6 |
Incorrect |
20 ms |
1624 KB |
Output isn't correct |
7 |
Incorrect |
44 ms |
2544 KB |
Output isn't correct |
8 |
Correct |
90 ms |
4932 KB |
Output is correct |
9 |
Incorrect |
212 ms |
9688 KB |
Output isn't correct |
10 |
Incorrect |
511 ms |
23468 KB |
Output isn't correct |