Submission #371018

#TimeUsernameProblemLanguageResultExecution timeMemory
371018FatihSolakTurnir (COCI17_turnir)C++17
0 / 100
2 ms512 KiB
#include <bits/stdc++.h> #define N 20 using namespace std; int arr[1<<N]; int brr[1<<N]; map<int,int> mp; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int n; cin >> n; for(int i = 0;i<(1<<n);i++){ cin >> arr[i]; brr[i] = arr[i]; } sort(brr,brr+(1<<n)); int cnt = 0; int num = 0; int pw = 1; for(int i=0;i<(1<<n);i++){ if((i-cnt) == pw){ cnt += pw; pw = pw*2; num++; } mp[brr[i]] = n-num; } for(int i=0;i<(1<<n);i++){ cout << mp[arr[i]] << " "; } }

Compilation message (stderr)

turnir.cpp: In function 'int main()':
turnir.cpp:10:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   10 |  freopen("in.txt","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
turnir.cpp:11:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   11 |  freopen("out.txt","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...