Submission #100741

# Submission time Handle Problem Language Result Execution time Memory
100741 2019-03-13T20:16:23 Z dalgerok Turnir (COCI17_turnir) C++17
100 / 100
1964 ms 55340 KB
#include<bits/stdc++.h>
using namespace std;




int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m = n, x;
    n = (1 << n);
    map < int, vector < int > > q;
    for(int i = 1; i <= n; i++){
        cin >> x;
        q[x].push_back(i);
    }
    int ans[n + 1];
    int cur = 0;
    for(auto it : q){
        cur += (int)it.second.size();
        int kek = floor(log2(cur));
        for(auto xx : it.second){
            ans[xx] = m - kek;
        }
    }
    for(int i = 1; i <= n; i++){
        cout << ans[i] << " ";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 16 ms 1664 KB Output is correct
6 Correct 61 ms 5240 KB Output is correct
7 Correct 125 ms 7292 KB Output is correct
8 Correct 132 ms 4784 KB Output is correct
9 Correct 928 ms 39388 KB Output is correct
10 Correct 1964 ms 55340 KB Output is correct