QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#730627 | #3836. So I'll Max Out My Constructive Algorithm Skills | RaislinSnow | WA | 1ms | 3748kb | C++20 | 1.7kb | 2024-11-09 20:53:01 | 2024-11-09 20:53:01 |
Judging History
answer
#pragma GCC optimize(3, "Ofast", "inline")
#define FOR(i, a, b) for(int i = (a); i <= (b); i ++)
#define ROF(i, a, b) for(int i = (a); i >= (b); i --)
#define debug(x) cerr << (#x) << ": " << (x) << '\n'
#define pb push_back
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef array<int, 2> pii;
typedef array<ll, 2> pll;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n;
int h[65][65];
void solve(int T) {
cin >> n;
FOR(i, 1, n) FOR(j, 1, n) cin >> h[i][j];
int t = 0;
for(int i = 1; i <= n; i += 2) {
FOR(j, 2, n) if(h[i][j] > h[i][j - 1]) t ++;
if(i != n) if(h[i + 1][n] > h[i][n]) t ++;
}
for(int i = 2; i <= n; i += 2) {
ROF(j, n - 1, 1) if(h[i][j] > h[i][j + 1]) t ++;
if(i != n) if(h[i + 1][1] > h[i][1]) t ++;
}
debug(t);
if(t <= (n * n - 1) / 2) {
FOR(i, 1, n) {
if(i & 1) {
FOR(j, 1, n - 1) cout << h[i][j] << ' ';
if(i == n) cout << h[i][n];
else cout << h[i][n] << ' ';
}
else {
ROF(j, n, 2) cout << h[i][j] << ' ';
if(i == n) cout << h[i][1];
else cout << h[i][1] << ' ';
}
}
}
else {
ROF(i, n, 1) {
if(!((i & 1) ^ (n & 1))) {
ROF(j, n, 2) cout << h[i][j] << ' ';
if(i == 1) cout << h[i][1];
else cout << h[i][1] << ' ';
}
else {
FOR(j, 1, n - 1) cout << h[i][j] << ' ';
if(i == 1) cout << h[i][n];
else cout << h[i][n] << ' ';
}
}
}
cout << '\n';
}
void init() {
}
signed main() {
IOS;
int t = 1;
cin >> t;
init();
FOR(T, 1, t) {
solve(T);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3748kb
input:
1 2 4 3 2 1
output:
4 3 1 2
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3656kb
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:
30 75 35 51 25 19 76 65 62 74 26 28 48 77 60 63 56 11 16 44 46 41 17 8 66 61 42 39 10 27 31 40 38 43 7 29 52 23 58 80 50 20 33 69 47 70 18 71 37 22 49 5 1 79 54 72 4 64 55 34 12 6 15 81 57 73 59 32 13 45 53 14 36 3 78 24 2 68 9 67 21 11 28 2 19 9 41 24 47 18 42 10 5 34 17 33 35 22 8 49 1 29 26 7 44 ...
result:
wrong answer [case 8] Not lazy, up = 35, down = 28