QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#366478#7178. BishopsGiga_Cronos#WA 14ms9324kbC++232.4kb2024-03-25 05:27:332024-03-25 05:27:34

Judging History

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

  • [2024-03-25 05:27:34]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:9324kb
  • [2024-03-25 05:27:33]
  • 提交

answer

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops",                  \
//                      "omit-frame-pointer", "inline")
// #pragma GCC target(                                                            \
//     "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,fma,tune=native")
// #pragma GCC option("arch=native", "no-zero-upper") // Enable AVX

/// UH Top
#include <bits/stdc++.h>
#define db(x)   cerr << #x << ':' << (x) << '\n';
#define all(v)  (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
// #define int ll
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
// typedef __int128_t int128;
typedef pair<ll, ll> pii;
typedef pair<ld, ll> pdi;
typedef pair<ld, ld> pdd;
typedef pair<ld, pdd> pdp;
typedef pair<string, ll> psi;
typedef pair<ll, string> pls;
typedef pair<string, string> pss;
typedef pair<ll, pii> pip;
typedef pair<pii, pii> ppp;
typedef complex<ld> point;
typedef vector<point> polygon;
typedef vector<ll> vi;
typedef pair<point, int> ppi;
#define prec(n)                                                                \
	cout.precision(n);                                                         \
	cout << fixed
const ll mod = (1e9 + 7);
const ld eps = (1e-9);
const ll oo = (ll)(1e9 + 5);
#define pi   acos(-1)
#define MAXN (ll)(1e6 + 5)

// vector<pii> solve(int n, int m) {

// 	return ans;
// }

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, m;
	cin >> n >> m;
	if (n == m) {
		cout << 2 * n - 2 << "\n";
		for (int i = 1; i <= n; i++)
			cout << i << ' ' << 1 << "\n";
		for (int i = 2; i <= n - 1; i++)
			cout << i << ' ' << n << "\n";
		return 0;
	}
	vector<pii> ans;
	bool invert = 0;
	if (n > m) {
		swap(n, m);
		invert = 1;
	}

	for (int i = 1; i <= n; i++)
		ans.push_back(pii(i, 1));
	for (int i = 1; i <= n; i++)
		ans.push_back(pii(i, m));

	int l1 = n / 2;
	int dst = m - 2 - (2 * l1);
	if (dst) {
		if (dst == 1 && !(n & 1)) {
			ans.push_back(pii(n / 2, (m + 1) / 2));
			ans.push_back(pii((n / 2) + 1, (m + 1) / 2));
		} else {
			for (int i = l1 + 2; i <= m - l1 - 1; i++)
				ans.push_back(pii(n / 2, i));
		}
	}

	for (auto &p : ans) {
		if (invert)
			swap(p.first, p.second);
	}

	cout << ans.size() << "\n";
	for (auto p : ans)
		cout << p.first << ' ' << p.second << "\n";

	return 0;
}

詳細信息

Test #1:

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

input:

2 5

output:

6
1 1
2 1
1 5
2 5
1 3
2 3

result:

ok n: 2, m: 5, bishops: 6

Test #2:

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

input:

5 5

output:

8
1 1
2 1
3 1
4 1
5 1
2 5
3 5
4 5

result:

ok n: 5, m: 5, bishops: 8

Test #3:

score: 0
Accepted
time: 13ms
memory: 3672kb

input:

100000 100000

output:

199998
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61...

result:

ok n: 100000, m: 100000, bishops: 199998

Test #4:

score: 0
Accepted
time: 14ms
memory: 9324kb

input:

100000 99999

output:

199998
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

result:

ok n: 100000, m: 99999, bishops: 199998

Test #5:

score: 0
Accepted
time: 14ms
memory: 8452kb

input:

100000 50000

output:

149998
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

result:

ok n: 100000, m: 50000, bishops: 149998

Test #6:

score: -100
Wrong Answer
time: 4ms
memory: 5284kb

input:

1 100000

output:

100000
1 1
1 100000
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
0 10
0 11
0 12
0 13
0 14
0 15
0 16
0 17
0 18
0 19
0 20
0 21
0 22
0 23
0 24
0 25
0 26
0 27
0 28
0 29
0 30
0 31
0 32
0 33
0 34
0 35
0 36
0 37
0 38
0 39
0 40
0 41
0 42
0 43
0 44
0 45
0 46
0 47
0 48
0 49
0 50
0 51
0 52
0 53
0 54
0 55
0 56
0 57
0 58
0 5...

result:

wrong answer Integer parameter [name=x] equals to 0, violates the range [1, 1]