# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
394786 | 2021-04-27T10:13:07 Z | Nima_Naderi | Swap (BOI16_swap) | C++14 | 41 ms | 332 KB |
//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
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 312 KB | Output is correct |
2 | Correct | 34 ms | 312 KB | Output is correct |
3 | Correct | 41 ms | 204 KB | Output is correct |
4 | Correct | 37 ms | 204 KB | Output is correct |
5 | Correct | 34 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 312 KB | Output is correct |
2 | Correct | 34 ms | 312 KB | Output is correct |
3 | Correct | 41 ms | 204 KB | Output is correct |
4 | Correct | 37 ms | 204 KB | Output is correct |
5 | Correct | 34 ms | 204 KB | Output is correct |
6 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 312 KB | Output is correct |
2 | Correct | 34 ms | 312 KB | Output is correct |
3 | Correct | 41 ms | 204 KB | Output is correct |
4 | Correct | 37 ms | 204 KB | Output is correct |
5 | Correct | 34 ms | 204 KB | Output is correct |
6 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 312 KB | Output is correct |
2 | Correct | 34 ms | 312 KB | Output is correct |
3 | Correct | 41 ms | 204 KB | Output is correct |
4 | Correct | 37 ms | 204 KB | Output is correct |
5 | Correct | 34 ms | 204 KB | Output is correct |
6 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 312 KB | Output is correct |
2 | Correct | 34 ms | 312 KB | Output is correct |
3 | Correct | 41 ms | 204 KB | Output is correct |
4 | Correct | 37 ms | 204 KB | Output is correct |
5 | Correct | 34 ms | 204 KB | Output is correct |
6 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
7 | Halted | 0 ms | 0 KB | - |