# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
636414 | 2022-08-29T08:35:42 Z | berr | Turnir (COCI17_turnir) | C++17 | 605 ms | 42208 KB |
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin>>n; // n-(ondan küçük eleman sayısının logu +1) vector<int> a(1<<n), b(1<<n), val((1<<n)), ans((1<<n)); for(int i=0; i<a.size(); i++) { cin>>a[i]; b[i]=a[i]; } int l=0, k=2; for(int i=0; i<(1<<n); i++) { if(i+1==k) { k*=2; l++; } val[i]=l; //cout<<val[i]<<" "; } sort(b.begin(), b.end()); for(int i=0; i<(1<<n); i++) { int pos=upper_bound(b.begin(), b.end(), a[i])-b.begin(); pos--; ans[i]=n-val[pos]; } for(auto i: ans) cout<<i<<" "; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 596 KB | Output is correct |
5 | Correct | 11 ms | 1484 KB | Output is correct |
6 | Correct | 24 ms | 2892 KB | Output is correct |
7 | Correct | 46 ms | 5328 KB | Output is correct |
8 | Correct | 103 ms | 10200 KB | Output is correct |
9 | Correct | 235 ms | 21216 KB | Output is correct |
10 | Correct | 605 ms | 42208 KB | Output is correct |