QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253755#7756. Omniscia Spares Noneucup-team1453WA 1ms3444kbC++113.8kb2023-11-17 14:19:402023-11-17 14:19:42

Judging History

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

  • [2023-11-17 14:19:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3444kb
  • [2023-11-17 14:19:40]
  • 提交

answer

#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define vi vector <int>
#define sz(a) ((int) (a).size())
#define me(f, x) memset(f, x, sizeof(f))
#define uint unsig7ned int
#define ull unsigned long long 
#define i128 __int128
using namespace std;
const int N = 1e6 + 7;
const int M = 1e8, D = 1e3;
int n; 
pair < int, int > pts[N];
pair < int, int > midp(vi S) {
	pair < int, int > sum = {0, 0};
	for(auto p : S) 
		sum.first += pts[p].first, 
		sum.second += pts[p].second;
	sum.first /= sz(S);
	sum.second /= sz(S);
	return sum;
}
vector < pair < int, int > > ans;
void lk(int x, int y) {
	ans.emplace_back(x, y);
}
void print() {
	cout << "Yes\n";
	L(i, 1, n) 
		cout << pts[i].first << ' ' << pts[i].second << '\n';
	cout << sz(ans) << '\n';
	for(auto&u : ans) 
		cout << u.first << ' ' << u.second << '\n';
}
void Main() {
	cin >> n;
	if(n <= 4) {
		cout << "Yes\n";
		L(i, 1, n) cout << 0 << ' ' << i << '\n';
		cout << 0 << '\n';
		return ;
	}
	if((n <= 7) || (n & 1)) {
		cout << "No\n";
		return ;
	}
	ans.clear();
	pts[1] = {0, M * 3};
	pts[2] = {-M * 3, 0};
	pts[3] = {M * 3, 0};
	lk(1, 2), lk(2, 3), lk(1, 3);
	if(n == 8) {
		pts[4] = midp({1, 2, 3}), lk(1, 4), lk(2, 4), lk(3, 4);
		pts[5] = midp({1, 2, 4}), lk(1, 5), lk(2, 5), lk(4, 5);
		pts[6] = midp({2, 3, 4}), lk(2, 6), lk(3, 6), lk(4, 6);
		pts[7] = midp({1, 3, 4}), lk(1, 7), lk(3, 7), lk(4, 7);
		pts[8] = {0, M * 4},    lk(1, 8), lk(2, 8), lk(3, 8);
		print();
		return ;
	}
	if(n % 4 == 2) {
		pts[4] = {-M, M};
		pts[5] = {M, M};
		lk(2, 4), lk(3, 5), lk(4, 5), lk(1, 4), lk(1, 5);
		pts[n - 3] = midp({1, 2, 4}), lk(n - 3, 1), lk(n - 3, 2), lk(n - 3, 4);
		pts[n - 2] = midp({1, 3, 5}), lk(n - 2, 1), lk(n - 2, 3), lk(n - 2, 5);
		L(o, 1, (n - 10) / 4) {
			int bp = o * 4 + 2, kd = D * (n - o);
			pts[bp] = {M / 2 - kd, M / 2 - kd};
			pts[bp + 1] = {M / 2 + kd, M / 2 - kd};
			pts[bp + 2] = {M / 2 - kd, M / 2 + kd};
			pts[bp + 3] = {M / 2 + kd, M / 2 + kd};
			lk(bp, bp + 1), lk(bp, bp + 2), lk(bp + 2, bp + 3), lk(bp + 1, bp + 3);
			lk(bp - 4, bp), lk(bp - 4, bp + 1);
			lk(bp - 3, bp + 1), lk(bp - 3, bp + 3);
			lk(bp - 1, bp + 3), lk(bp - 1, bp + 2);
			lk(bp - 2, bp + 2), lk(bp - 2, bp);
		}
		pts[n - 4] = midp({n - 8, n - 7, n - 6, n - 5});
		lk(n - 4, n - 8), lk(n - 4, n - 7), lk(n - 4, n - 6), lk(n - 4, n - 5);
		pts[n - 1] = midp({n - 8, n - 6, n - 4}), lk(n - 1, n - 8), lk(n - 1, n - 6), lk(n - 1, n - 4);
		pts[n] = midp({n - 4, n - 5, n - 7}), lk(n, n - 4), lk(n, n - 5), lk(n, n - 7);
		print();
		return ;
	}
	if(n % 4 == 0) {
		L(o, 1, (n - 8) / 4) {
			int bp = o * 4, kd = D * (n - o);
			pts[bp] = {M / 2 - kd, M / 2 - kd};
			pts[bp + 1] = {M / 2 + kd, M / 2 - kd};
			pts[bp + 2] = {M / 2 - kd, M / 2 + kd};
			pts[bp + 3] = {M / 2 + kd, M / 2 + kd};
			lk(bp, bp + 1), lk(bp, bp + 2), lk(bp + 2, bp + 3), lk(bp + 1, bp + 3);
			if(o == 1) continue;
			lk(bp - 2, bp + 2);
			lk(bp - 4, bp + 2), lk(bp - 4, bp);
			lk(bp - 3, bp), lk(bp - 3, bp + 1), lk(bp - 3, bp + 3);
			lk(bp - 1, bp + 3), lk(bp - 1, bp + 2);
		}
		lk(1, 6), lk(1, 7);
		lk(2, 6), lk(2, 4);
		lk(3, 5), lk(3, 7), lk(3, 4);
		pts[n - 3] = midp({1, 2, 6}), lk(n - 3, 1), lk(n - 3, 2), lk(n - 3, 6);
		pts[n - 2] = {0, M * 4}, lk(n - 2, 1), lk(n - 2, 2), lk(n - 2, 3);
		
		pts[n - 4] = midp({n - 6, n - 6, n - 5, n - 8, n - 7});
		lk(n - 6, n - 4), lk(n - 5, n - 4), lk(n - 8, n - 4), lk(n - 5, n - 8);
		
		pts[n - 1] = midp({n - 4, n - 5, n - 8}), lk(n - 1, n - 4), lk(n - 1, n - 5), lk(n - 1, n - 8);
		pts[n] = midp({n - 5, n - 7, n - 8}), lk(n, n - 5), lk(n, n - 7), lk(n, n - 8);
		print();
		return;
	}
}
int main() {
	ios :: sync_with_stdio(false);
	cin.tie(0); cout.tie(0); 
	Main();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3

output:

Yes
0 1
0 2
0 3
0

result:

ok OK, Accepted.

Test #2:

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

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: 3404kb

input:

1

output:

Yes
0 1
0

result:

ok OK, Accepted.

Test #4:

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

input:

2

output:

Yes
0 1
0 2
0

result:

ok OK, Accepted.

Test #5:

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

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

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

input:

6

output:

No

result:

ok OK, Accepted.

Test #7:

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

input:

7

output:

No

result:

ok OK, Accepted.

Test #8:

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

input:

8

output:

Yes
0 300000000
-300000000 0
300000000 0
0 100000000
-100000000 133333333
0 33333333
100000000 133333333
0 400000000
18
1 2
2 3
1 3
1 4
2 4
3 4
1 5
2 5
4 5
2 6
3 6
4 6
1 7
3 7
4 7
1 8
2 8
3 8

result:

ok OK, Accepted.

Test #9:

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

input:

9

output:

No

result:

ok OK, Accepted.

Test #10:

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

input:

10

output:

Yes
0 300000000
-300000000 0
300000000 0
-100000000 100000000
100000000 100000000
0 50000000
-133333333 133333333
133333333 133333333
-133333333 50000000
133333333 50000000
24
1 2
2 3
1 3
2 4
3 5
4 5
1 4
1 5
7 1
7 2
7 4
8 1
8 3
8 5
6 2
6 3
6 4
6 5
9 2
9 4
9 6
10 6
10 5
10 3

result:

ok OK, Accepted.

Test #11:

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

input:

11

output:

No

result:

ok OK, Accepted.

Test #12:

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

input:

12

output:

Yes
0 300000000
-300000000 0
300000000 0
49989000 49989000
50011000 49989000
49989000 50011000
50011000 50011000
49997800 50002200
-83337000 116670333
0 400000000
49999266 50000733
50003666 49996333
30
1 2
2 3
1 3
4 5
4 6
6 7
5 7
1 6
1 7
2 6
2 4
3 5
3 7
3 4
9 1
9 2
9 6
10 1
10 2
10 3
6 8
7 8
4 8
7 4...

result:

wrong answer More than 4 Points' Degrees are Less than 6