QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#72220#3836. So I'll Max Out My Constructive Algorithm Skillsneko_nyaa#WA 0ms3372kbC++23784b2023-01-15 10:07:342023-01-15 10:07:35

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-15 10:07:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3372kb
  • [2023-01-15 10:07:34]
  • 提交

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