Submission #636414

#TimeUsernameProblemLanguageResultExecution timeMemory
636414berrTurnir (COCI17_turnir)C++17
100 / 100
605 ms42208 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin>>n; // n-(ondan küçük eleman sayısının logu +1) vector<int> a(1<<n), b(1<<n), val((1<<n)), ans((1<<n)); for(int i=0; i<a.size(); i++) { cin>>a[i]; b[i]=a[i]; } int l=0, k=2; for(int i=0; i<(1<<n); i++) { if(i+1==k) { k*=2; l++; } val[i]=l; //cout<<val[i]<<" "; } sort(b.begin(), b.end()); for(int i=0; i<(1<<n); i++) { int pos=upper_bound(b.begin(), b.end(), a[i])-b.begin(); pos--; ans[i]=n-val[pos]; } for(auto i: ans) cout<<i<<" "; }

Compilation message (stderr)

turnir.cpp: In function 'int32_t main()':
turnir.cpp:13:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0; i<a.size(); i++)
      |                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...