Submission #371018

# Submission time Handle Problem Language Result Execution time Memory
371018 2021-02-25T15:47:15 Z FatihSolak Turnir (COCI17_turnir) C++17
0 / 100
2 ms 512 KB
#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

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 time Memory Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Incorrect 2 ms 364 KB Output isn't correct
3 Incorrect 2 ms 512 KB Output isn't correct
4 Incorrect 2 ms 364 KB Output isn't correct
5 Incorrect 2 ms 364 KB Output isn't correct
6 Incorrect 2 ms 364 KB Output isn't correct
7 Incorrect 2 ms 364 KB Output isn't correct
8 Incorrect 2 ms 364 KB Output isn't correct
9 Incorrect 2 ms 364 KB Output isn't correct
10 Incorrect 2 ms 364 KB Output isn't correct