Submission #147585

#TimeUsernameProblemLanguageResultExecution timeMemory
147585Ruxandra985Turnir (COCI17_turnir)C++14
100 / 100
379 ms18776 KiB
#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 (stderr)

turnir.cpp: In function 'int main()':
turnir.cpp:11:13: warning: unused variable 'sol' [-Wunused-variable]
     int n,i,sol,j;
             ^~~
turnir.cpp:12:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d",&n);
     ~~~~~~^~~~~~~~~
turnir.cpp:14:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf ("%d",&v[i].first);
         ~~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...