QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#142116#5575. Knight's Tour Reduxammardab3an#RE 0ms3456kbC++171.5kb2023-08-18 15:09:402023-08-18 15:09:42

Judging History

This is the latest submission verdict.

  • [2023-08-18 15:09:42]
  • Judged
  • Verdict: RE
  • Time: 0ms
  • Memory: 3456kb
  • [2023-08-18 15:09:40]
  • Submitted

answer

#include <bits/stdc++.h>


using namespace std;

int main(){
	int n;
	cin >> n;
	vector<pair<int, int>>v10 = { {1,1},{4,2},{3,5},{2,8},{5,9},{6,6},{7,3},{10,4},{9,7},{8,10} };
	vector<pair<int, int>>v8 = { {1,1},{2,4},{3,7},{6,8},{5,5},{4,2},{7,3},{8,6} };
	vector<pair<int, int>>v7 = { {1,1},{4,2},{3,7},{6,6},{7,3},{4,2},{5,5} };
	vector<pair<int, int>>v6 = { {1,1},{2,4},{5,5},{6,2},{3,3},{4,6} };

	if (n == 12 || n == 13) {
		int cur = 0;
		for (auto x : v6) {
			cout << x.first + cur << " " << x.second + cur << '\n';
		}
		cur = 6;
		for (auto x : v6) {
			cout << x.first + cur << " " << x.second + cur << '\n';
		}
		cur = 12;
		if (n == 13) {
			cout << 13 << " " << 13 << '\n';
		}
		return 0;
	}

	for (int i = 0; i < 4; i++) {
		if (n < i * 10)break;
		int m = (n - i * 10) % 8;
		if (!m || m == 1 || m == 7 || m == 6) {
			cout << "POSSIBLE\n";
			int cur = 0;
			for (int j = 0; j < i; j++) {
				for (auto x : v10)cout << x.first + cur << " " << x.second + cur << '\n';
				cur += 10;
			}
			n -= 10 * i;
			int mm = n / 8;
			while (mm--) {
				for (auto x : v8) {
					cout << x.first + cur << " " << x.second + cur << '\n';
				}
				n -= 8;
				cur += 8;
			}
			if (m == 1) {
				cout << cur + 1 << " " << cur + 1 << '\n';
			}
			else if (m == 7) {
				for (auto x : v7) {
					cout << x.first + cur << " " << x.second + cur << '\n';
				}
			}
			else if (m == 6) {
				for (auto x : v6) {
					cout << x.first + cur << " " << x.second + cur << '\n';
				}
			}
			return 0;
		}
	}
	return 1;
}

詳細信息

Test #1:

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

input:

1

output:

POSSIBLE
1 1

result:

ok answer = 1

Test #2:

score: -100
Runtime Error

input:

2

output:


result: