QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#248566#7619. Make SYSU Great Again Iucup-team027#WA 0ms3620kbC++231.0kb2023-11-11 20:00:352023-11-11 20:00:35

Judging History

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

  • [2023-11-11 20:00:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2023-11-11 20:00:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template <typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>;

#define int long long

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);

	int n, k; cin >> n >> k;
	map<pair<int, int>, int> filled;
	int x = 1, y = 1;
	for (int i = 1; i <= 2*n; i += 2) {
		filled[{x, y}] = i;
		if (i+1 == 2*n) {
			filled[{x, 1}] = i+1;
		} else {
			filled[{x, y+1}] = i+1;
		}
		x++; y++;
	}

	int cur = 2*n+1;
	for (x = 1; x <= n; x++) {
		if (cur >= k) break;
		for (y = 1; y <= n; y++) {
			if (cur >= k) break;
			if (filled[{x, y}] == 0) {
				filled[{x, y}] = cur;
				cur++;
			}
		}
	}

	vector<pair<int, int>> ans(k+1);
	for (auto [u, v]: filled) {
		ans[v] = u;
	}
	for (int i = 1; i <= k; i++) {
		cout << ans[i].first << ' ' << ans[i].second << '\n';
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3504kb

input:

3 6

output:

1 1
1 2
2 2
2 3
3 3
3 1

result:

ok The answer is correct.

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3620kb

input:

3 7

output:

1 1
1 2
2 2
2 3
3 3
3 1
0 0

result:

wrong answer Integer 0 violates the range [1, 3]