QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#72220 | #3836. So I'll Max Out My Constructive Algorithm Skills | neko_nyaa# | WA | 0ms | 3372kb | C++23 | 784b | 2023-01-15 10:07:34 | 2023-01-15 10:07:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n; cin >> n;
int a[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
vector<int> ans;
for (int i = 0; i < n; i++) {
if (i % 2) {
reverse(a[i], a[i]+n);
}
for (int j = 0; j < n; j++) {
ans.push_back(a[i][j]);
}
}
int sc = 0;
for (int i = 1; i < n; i++) {
if (a[i] > a[i-1]) sc--;
else sc++;
}
if (sc < 0) {
reverse(ans.begin(), ans.end());
}
for (int i = 0; i < n*n; i++) {
cout << ans[i];
if (i == n*n-1) cout << '\n';
else cout << ' ';
}
}
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
int t; cin >> t;
while (t--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3372kb
input:
1 2 4 3 2 1
output:
2 1 3 4
result:
wrong answer [case 1] Not lazy, up = 2, down = 1