답안 #1100617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1100617 2024-10-14T10:37:07 Z vjudge1 Swap (BOI16_swap) C++17
10 / 100
72 ms 4600 KB
//UNSTOPPABLE
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define tpii pair <pair <int,int> , int>
#define bruh cout << "NO\n"
using namespace std;
using namespace __gnu_pbds;
const int N = 3e5 + 5;
int mod = 1e9 + 7;
const int INF = 1e18;
int n,a[N],p[N],ans[N];
void Goldik(){
	cin >> n;
	for(int i = 1 ; i <= n ; i++){
		cin >> a[i];
		ans[i] = a[i];
	}
	for(int mask = 0 ; mask < (1 << n) ; mask++){
		for(int i = 1 ; i <= n ; i++){
			p[i] = a[i];
		}
		for(int i = 2 ; i <= n ; i++){
			if(((mask >> (i - 1)) & 1)){
				swap(p[i] , p[i / 2]);
			}
		}
		bool oknt = 0;
		for(int i = 1 ; i <= n ; i++){
			if(p[i] > ans[i]){
				oknt = 1;
				break;
			}
			if(ans[i] > p[i]) break;
		}
		if(!oknt){
			for(int i = 1 ; i <= n ; i++){
				ans[i] = p[i];
			}
		}
	}
	for(int i = 1 ; i <= n ; i++){
		cout << ans[i] << ' ';
	}
}
//rewai mnogo zadach vozmozhno odna iz nih gde to popadetsya
//returning winter prime?
//chem prowe tem luchshe
signed main(/*AZ AZDAN UZDIKSIZ*/){
	//freopen("txt.in","r",stdin);
	//freopen("txt.out","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	srand(time(0));
	int TT = 1;
	// cin >> TT;
	for(int i = 1 ; i <= TT ; i++){
		//cout << "Case " << i << ": ";
		Goldik();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 4432 KB Output is correct
2 Correct 66 ms 4600 KB Output is correct
3 Correct 72 ms 4436 KB Output is correct
4 Correct 63 ms 4436 KB Output is correct
5 Correct 63 ms 4436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 4432 KB Output is correct
2 Correct 66 ms 4600 KB Output is correct
3 Correct 72 ms 4436 KB Output is correct
4 Correct 63 ms 4436 KB Output is correct
5 Correct 63 ms 4436 KB Output is correct
6 Incorrect 1 ms 4436 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 4432 KB Output is correct
2 Correct 66 ms 4600 KB Output is correct
3 Correct 72 ms 4436 KB Output is correct
4 Correct 63 ms 4436 KB Output is correct
5 Correct 63 ms 4436 KB Output is correct
6 Incorrect 1 ms 4436 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 4432 KB Output is correct
2 Correct 66 ms 4600 KB Output is correct
3 Correct 72 ms 4436 KB Output is correct
4 Correct 63 ms 4436 KB Output is correct
5 Correct 63 ms 4436 KB Output is correct
6 Incorrect 1 ms 4436 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 4432 KB Output is correct
2 Correct 66 ms 4600 KB Output is correct
3 Correct 72 ms 4436 KB Output is correct
4 Correct 63 ms 4436 KB Output is correct
5 Correct 63 ms 4436 KB Output is correct
6 Incorrect 1 ms 4436 KB Output isn't correct
7 Halted 0 ms 0 KB -