QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#578054#1833. DeletingWorld_CreaterWA 1ms5744kbC++17529b2024-09-20 16:13:302024-09-20 16:13:31

Judging History

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

  • [2024-09-20 16:13:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5744kb
  • [2024-09-20 16:13:30]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,a[4005][4005];
bitset<4005> f[4005];
bool check(int x)
{
	for(int i=n-1;i>=1;i--)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(a[i][j]<=x&&(j==i+1||f[i+1][j-1]))
			{
				f[i][j]=1;
				f[i]|=f[j+1];
			}
		}
	}
	return f[1][n];
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j+=2)
		{
			cin>>a[i][j];
		}
	}
	int l=1,r=(n/2)*(n/2);
	while(l<r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	cout<<l;
}

详细

Test #1:

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

input:

2
1

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

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: 1ms
memory: 5680kb

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: -100
Wrong Answer
time: 1ms
memory: 5744kb

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:

1

result:

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