Submission #944050

#TimeUsernameProblemLanguageResultExecution timeMemory
944050artixkrishnaTurnir (COCI17_turnir)C++14
100 / 100
430 ms17592 KiB
#include <cstdio> #include <string> #include <vector> #include <map> #include <cstdlib> #include <algorithm> #include <cstring> using namespace std; typedef long long llint; typedef pair <int, int> pii; const int MAXN = 20; int n; int a[1 << MAXN]; int calc (int x) { if (x == 0) return 0; for (int i = n-1; i >= 0; --i) { if ((1 << i) < x) x -= (1 << i); else return n - i; } return n; } int main (void){ scanf("%d", &n); vector <int> V; for (int i = 0; i < (1 << n); ++i) { scanf("%d", &a[i]); V.push_back(a[i]); } sort(V.begin(), V.end()); for (int i = 0; i < (1 << n); ++i) { printf("%d ", calc(V.end() - upper_bound(V.begin(), V.end(), a[i]))); } return 0; }

Compilation message (stderr)

turnir.cpp: In function 'int main()':
turnir.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
turnir.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     scanf("%d", &a[i]);
      |     ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...