| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 394786 | Nima_Naderi | Swap (BOI16_swap) | C++14 | 41 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//In the name of God
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
//typedef long long ll;
typedef int ll;
const ll MXN = 20 + 10;
ll n;
ll A[MXN], B[MXN], C[MXN], ANS[MXN];
bool check(){
for(int i = 1; i <= n; i ++){
if(ANS[i] == B[i]) continue;
return (B[i] < ANS[i]);
}
return 0;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i ++) cin >> A[i];
memcpy(ANS, A, sizeof A);
if(n > 20) return 0;
for(int mask = 0; mask < (1LL << (n - 1)); mask ++){
memcpy(B, A, sizeof A);
for(int i = 2; i <= n; i ++){
if((mask >> (i - 2)) & 1LL){
swap(B[i], B[i / 2]);
}
}
if(check()){
memcpy(ANS, B, sizeof B);
}
}
for(int i = 1; i <= n; i ++) cout << ANS[i] << ' '; cout <<'\n';
return 0;
}
//! N.N
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
