# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
258602 |
2020-08-06T08:25:48 Z |
임성재(#5051) |
Swap (BOI16_swap) |
C++17 |
|
1000 ms |
384 KB |
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(NULL)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed; cout.precision(a)
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9;
const ll INF = 1e18;
int n;
int a[100010];
int ans[30];
int dfs(int x) {
if(x > n) {
bool flag = false;
for(int i=1; i<=n; i++) {
if(a[i] > ans[i]) flag = false;
else if(a[i] < ans[i]) flag = true;
else continue;
break;
}
if(flag) {
for(int i=1; i<=n; i++) {
ans[i] = a[i];
}
}
return 0;
}
if(0 && x > n/2) {
if(a[x/2] > a[x]) {
swap(a[x/2], a[x]);
}
dfs(x+1);
}
else {
dfs(x+1);
swap(a[x/2], a[x]);
dfs(x+1);
swap(a[x/2], a[x]);
}
}
int main() {
fast;
cin >> n;
for(int i=1; i<=n; i++) {
cin >> a[i];
ans[i] = a[i];
}
dfs(2);
for(int i=1; i<=n; i++) {
cout << ans[i] << " ";
}
}
Compilation message
swap.cpp: In function 'int dfs(int)':
swap.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Execution timed out |
1085 ms |
384 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Execution timed out |
1085 ms |
384 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Execution timed out |
1085 ms |
384 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Execution timed out |
1085 ms |
384 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |