QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103455#1833. DeletingGemini7XWA 3ms9752kbC++141.2kb2023-05-05 22:00:382023-05-05 22:00:49

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-05 22:00:49]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:9752kb
  • [2023-05-05 22:00:38]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn = 4005;
template <typename T>
void read(T &x) {
	T sgn = 1;
	char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (x = 0; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
	x *= sgn;
}
int n, c[maxn][maxn];
pair<int, int> pos[4010005];
bitset<maxn> f[maxn], g[maxn];
void ins(int x, int y) {
	f[x].set(y); g[y].set(x);
	if (x > 1 && y < n && c[x][y] > c[x - 1][y + 1])
		ins(x - 1, y + 1);
	for (int now = (f[y + 1] & (~f[x]))._Find_next(y); now <= n; now = (f[y + 1] & (~f[x]))._Find_next(now)) {
		ins(x, now);
	}
	for (int now = (g[x - 1] & (~g[y]))._Find_next(0); now < x; now = (g[x - 1] & (~g[y]))._Find_next(now)) {
		ins(now, y); 
	}
}
int main() {
//	freopen("deleting.in", "r", stdin); freopen("deleting.out", "w", stdout);
	read(n);
	for (int i = 1; i < n; i++) {
		for (int j = i + 1; j <= n; j += 2) {
			read(c[i][j]);
			pos[c[i][j]] = make_pair(i, j);
		}
	}
	for (int i = 1; i <= (n / 2) * (n / 2); i++) {
		int l = pos[i].first, r = pos[i].second;
		if ((l + 1 == r || f[l + 1].test(r - 1)) && !f[l].test(r)) ins(l, r);
		if (f[1].test(n)) {
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}

詳細信息

Test #1:

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

input:

2
1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 2ms
memory: 7628kb

input:

6
2 1 3
4 5
6 7
8
9

output:

6

result:

ok 1 number(s): "6"

Test #3:

score: 0
Accepted
time: 3ms
memory: 7684kb

input:

10
20 21 2 11 25
3 24 18 8
6 17 7 5
22 4 23
14 15 1
19 16
12 10
13
9

output:

14

result:

ok 1 number(s): "14"

Test #4:

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

input:

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

output:

30

result:

ok 1 number(s): "30"

Test #5:

score: 0
Accepted
time: 3ms
memory: 7688kb

input:

20
91 19 90 92 5 41 15 50 18 36
97 8 23 74 53 67 83 40 26
4 16 31 82 80 28 49 6 21
58 63 70 34 27 89 68 20
55 100 35 77 52 24 11 87
94 13 66 1 32 54 86
60 79 75 93 45 73 2
48 72 12 37 29 95
56 17 44 84 30 22
14 65 76 69 62
47 78 7 57 42
39 61 99 81
88 25 98 59
85 38 10
33 51 71
64 46
43 3
96
9

output:

54

result:

ok 1 number(s): "54"

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 9752kb

input:

100
750 481 1065 911 1943 427 1633 45 1841 234 1376 1075 1603 1682 1581 1284 28 5 1567 1540 2409 1430 695 667 1246 392 1183 1090 594 1481 524 2023 354 778 584 827 1516 796 1675 1829 189 1688 706 1679 1483 1010 1209 1393 399 210
40 149 1040 351 1435 320 340 577 898 449 1896 224 2168 1456 1222 1216 19...

output:

1334

result:

wrong answer 1st numbers differ - expected: '1289', found: '1334'