답안 #856108

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
856108 2023-10-02T16:45:35 Z vjudge1 Turnir (COCI17_turnir) C++17
0 / 100
3000 ms 65536 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()
const int N = 4e5+1;


void solve() {
	int n;
	cin >> n;
	int N = n;
	n = pow(2,n);
	vi a(n+1);
	F(i,n) cin >> a[i];
	map<int,int> mp,mp2;
	F(i,n) mp[a[i]]++;
	vi bg(n+1);
	vector<pii> ps(n+1);
	F(i,n) ps[i] = {a[i],i};
	sort(ps.begin()+1,ps.end());
	F(i,n) mp2[ps[i].first]++,bg[ps[i].second] = i-mp2[ps[i].first]+mp[ps[i].first];
	vi ans(n+1);
	F(i,n) {
		for (int j=0;j<n;j++) {
			if (bg[i] >= (1<<j)-1) ans[i] = N-j;
		}
	}
	F(i,n) cout << ans[i] << " ";
	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();
}


# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 ms 600 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Incorrect 82 ms 604 KB Output isn't correct
5 Incorrect 990 ms 2948 KB Output isn't correct
6 Execution timed out 3012 ms 7952 KB Time limit exceeded
7 Execution timed out 3034 ms 12628 KB Time limit exceeded
8 Execution timed out 3071 ms 13764 KB Time limit exceeded
9 Execution timed out 3013 ms 61604 KB Time limit exceeded
10 Runtime error 1162 ms 65536 KB Execution killed with signal 9