# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147585 | 2019-08-30T07:32:02 Z | Ruxandra985 | Turnir (COCI17_turnir) | C++14 | 379 ms | 18776 KB |
#include <cstdio> #include <algorithm> #define DIM 1048580 using namespace std; pair <int,int> v[DIM]; int ed[DIM],logg[DIM]; int main() { //freopen ("a.in" , "r" , stdin); //freopen ("a.out" , "w" , stdout); int n,i,sol,j; scanf ("%d",&n); for (i=1;i<=(1<<n);i++){ scanf ("%d",&v[i].first); v[i].second = i; if (i==1) logg[i] = 0; else logg[i] = logg[i/2]+1; } sort (v+1,v+(1<<n)+1); for (i=1;i<=(1<<n);i++){ if (i == (1<<n) || v[i].first != v[i+1].first){ /// solve /// sunt i-1 mai mici for ( j = i ; v[j].first == v[i].first && j ; j--) ed[v[j].second] = n - logg[i]; } } for (i=1;i<=(1<<n);i++) printf ("%d ",ed[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 13 ms | 888 KB | Output is correct |
6 | Correct | 24 ms | 1528 KB | Output is correct |
7 | Correct | 46 ms | 2552 KB | Output is correct |
8 | Correct | 90 ms | 4984 KB | Output is correct |
9 | Correct | 185 ms | 9720 KB | Output is correct |
10 | Correct | 379 ms | 18776 KB | Output is correct |