QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394531#7756. Omniscia Spares NonezhaohaikunWA 1ms3720kbC++202.6kb2024-04-20 15:46:482024-04-20 15:46:50

Judging History

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

  • [2024-04-20 15:46:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3720kb
  • [2024-04-20 15:46:48]
  • 提交

answer

// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "\033[33m[" << __LINE__ << "]\033[0m "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> T& chkmax(T& x, T y) {return x = max(x, y);}
template <typename T> T& chkmin(T& x, T y) {return x = min(x, y);}
template <typename T> T& read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	return x *= f;
}
pair <int, int> p[10101];
vector <pair <int, int>> e;
signed main() {
	int n;
	cin >> n;
	if (n <= 4) {
		cout << "Yes\n";
		F(i, 1, n) cout << 0 << ' ' << i << '\n';
		cout << 0;
		return 0;
	}
	if (n <= 6 || (n & 1)) {
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
	p[1] = make_pair(0, 1);
	p[2] = make_pair(0, - 1);
	p[3] = make_pair(- 1, 0);
	p[4] = make_pair(1, 0);
	p[5] = make_pair(0, 2);
	p[6] = make_pair(0, - 2);
	p[7] = make_pair(- 2, 0);
	p[8] = make_pair(2, 0);
	e.emplace_back(5, 7);
	e.emplace_back(5, 3);
	e.emplace_back(5, 1);
	e.emplace_back(5, 4);
	e.emplace_back(5, 8);
	e.emplace_back(1, 3);
	e.emplace_back(1, 4);
	e.emplace_back(7, 3);
	e.emplace_back(3, 4);
	e.emplace_back(4, 8);
	e.emplace_back(3, 2);
	e.emplace_back(4, 2);
	e.emplace_back(7, 6);
	e.emplace_back(3, 6);
	e.emplace_back(2, 6);
	e.emplace_back(4, 6);
	e.emplace_back(8, 6);
	int c = 8;
	while (c < n) {
		if (c % 4 == 0) {
			p[c + 1] = make_pair(0, c / 4 + 1);
			p[c + 2] = make_pair(0, - (c / 4 + 1));
			e.emplace_back(c + 1, c - 1);
			e.emplace_back(c + 1, c);
			e.emplace_back(c + 1, c - 3);
			e.emplace_back(c + 2, c - 1);
			e.emplace_back(c + 2, c);
			e.emplace_back(c + 2, c - 2);
		} else {
			p[c + 1] = make_pair(- (c / 4 + 1), 0);
			p[c + 2] = make_pair(c / 4 + 1, 0);
			e.emplace_back(c + 1, c - 1);
			e.emplace_back(c + 1, c);
			e.emplace_back(c + 1, c - 3);
			e.emplace_back(c + 2, c - 1);
			e.emplace_back(c + 2, c);
			e.emplace_back(c + 2, c - 2);
		}
		c += 2;
	}
	if (c % 4 == 0) {
		p[c - 3].first = p[c - 2].first = 1e9;
	} else {
		p[c - 3].second = p[c - 2].second = 1e9;
	}
	e.emplace_back(c - 3, c - 2);
	F(i, 1, n) cout << p[i].first << ' ' << p[i].second << '\n';
	cout << e.size() << '\n';
	for (auto [a, b]: e) cout << a << ' ' << b << '\n';
	return 0;
}
/* why?
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3572kb

input:

3

output:

Yes
0 1
0 2
0 3
0

result:

ok OK, Accepted.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3704kb

input:

4

output:

Yes
0 1
0 2
0 3
0 4
0

result:

ok OK, Accepted.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

1

output:

Yes
0 1
0

result:

ok OK, Accepted.

Test #4:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

2

output:

Yes
0 1
0 2
0

result:

ok OK, Accepted.

Test #5:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

6

output:

No

result:

ok OK, Accepted.

Test #7:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

7

output:

No

result:

ok OK, Accepted.

Test #8:

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

input:

8

output:

Yes
0 1
0 -1
-1 0
1 0
1000000000 2
1000000000 -2
-2 0
2 0
18
5 7
5 3
5 1
5 4
5 8
1 3
1 4
7 3
3 4
4 8
3 2
4 2
7 6
3 6
2 6
4 6
8 6
5 6

result:

wrong answer Invalid Planar Graph : segments (5, 7) and (1, 3) intersect