Submission #198999

# Submission time Handle Problem Language Result Execution time Memory
198999 2020-01-28T15:15:33 Z TadijaSebez Swap (BOI16_swap) C++11
0 / 100
5 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
const int inf=1e9+7;
pair<int,int> min(pair<int,int> a,pair<int,int> b){return a<b?a:b;}
int main(){
	int n;
	scanf("%i",&n);
	vector<int> a(n*2+5,inf),ans(n+1);
	for(int i=1;i<=n;i++)scanf("%i",&a[i]);
	for(int i=1;i<=n;i++){
		pair<int,int> mn=min(mp(a[i<<1],i<<1),mp(a[i<<1|1],i<<1|1));
		int j=i;
		while(j){
			mn=min(mn,mp(a[j],j));
			if(j&1)mn=min(mn,mp(a[j^1],j^1));
			j/=2;
		}
		ans[i]=mn.first;
		a[mn.second]=inf;
		printf("%i ",ans[i]);
	}
	return 0;
}

Compilation message

swap.cpp: In function 'int main()':
swap.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&n);
  ~~~~~^~~~~~~~~
swap.cpp:10:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++)scanf("%i",&a[i]);
                       ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -