QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#197249 | #3836. So I'll Max Out My Constructive Algorithm Skills | PHarr# | WA | 1ms | 3476kb | C++20 | 760b | 2023-10-02 13:44:54 | 2023-10-02 13:44:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
using vi = vector<int>;
void solve() {
int n;
cin >> n;
vector<int> a;
for (int i = 1; i <= n; i++) {
vi b(n);
for (auto &j: b) cin >> j;
if (i & 1) reverse(b.begin(), b.end());
for (auto j: b) a.push_back(j);
}
int x = 0, y = 0;
for (int i = 1; i < a.size(); i++)
x += (a[i] > a[i - 1]), y += (a[i] < a[i]);
if( x < y )
reverse( a.begin(), a.end() );
for( auto i : a)
cout << i << " \n"[i == a.back()];
return ;
}
int32_t main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int TC;
for (cin >> TC; TC; TC--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3476kb
input:
1 2 4 3 2 1
output:
3 4 2 1
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3424kb
input:
100 9 30 75 35 51 25 19 76 65 62 11 56 63 60 77 48 28 26 74 16 44 46 41 17 8 66 61 42 29 7 43 38 40 31 27 10 39 52 23 58 80 50 20 33 69 47 79 1 5 49 22 37 71 18 70 54 72 4 64 55 34 12 6 15 14 53 45 13 32 59 73 57 81 36 3 78 24 2 68 9 67 21 7 11 28 2 19 9 41 24 17 34 5 10 42 18 47 33 35 22 8 49 1 29 ...
output:
62 65 76 19 25 51 35 75 30 11 56 63 60 77 48 28 26 74 42 61 66 8 17 41 46 44 16 29 7 43 38 40 31 27 10 39 47 69 33 20 50 80 58 23 52 79 1 5 49 22 37 71 18 70 15 6 12 34 55 64 4 72 54 14 53 45 13 32 59 73 57 81 21 67 9 68 2 24 78 3 36 24 41 9 19 2 28 11 17 34 5 10 42 18 47 29 1 49 8 22 35 33 14 20 12...
result:
wrong answer [case 1] Not lazy, up = 44, down = 36