QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#102015#6308. MagicSmallBlackWA 79ms6628kbC++141.0kb2023-05-02 09:57:472023-05-02 09:57:50

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-02 09:57:50]
  • 评测
  • 测评结果:WA
  • 用时:79ms
  • 内存:6628kb
  • [2023-05-02 09:57:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
inline long long read()
{
	long long s=0,k=1;
	char c=getchar();
	while(!isdigit(c))
	{
		k=(c=='-')?-1:1;
		c=getchar();
	}
	while(isdigit(c))
	{
		s=s*10+c-'0';
		c=getchar();
	}
	return s*k;
}
#define d read()
#define ll long long
#define Maxn 10010
#define Size 5010
#define mp make_pair
#define pb push_back
#define fi first
#define se second
int ptn[Size],n,cnt;
vector<pair<int,int> >t;
bitset<Size>vis,e[Size];
bool dfs(int u)
{
	auto now=vis&e[u];
	for(int v=now._Find_first();v<n;v=now._Find_next(v))
	{
		vis.reset(v);
		if((!ptn[v])||dfs(ptn[v]))
		{
			ptn[v]=u;
			return 1;
		}
	}
	return 0;
}
int main()
{
	n=d;
	for(int i=0;i<n;i++)
	{
		ll l=d,r=d;
		t.pb(mp(l,r));
	}
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(i^j)
				if(t[i].fi<t[j].fi&&t[j].fi<t[i].se&&t[i].se<t[j].se)
					e[j].set(i);
	cnt=2*n,vis.set();
	for(int i=0;i<n;i++)
		if(dfs(i))
			cnt--,vis.set();
	printf("%lld\n",cnt);
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3416kb

input:

5
2 3
6 7
1 9
5 10
4 8

output:

9

result:

ok 1 number(s): "9"

Test #2:

score: -100
Wrong Answer
time: 79ms
memory: 6628kb

input:

5000
7985 7987
42 46
1591 1593
407 410
6305 6306
1456 1457
5874 5875
7135 7137
7041 7046
6813 6815
8868 8871
665 666
4055 4056
9789 9796
7067 7068
4745 4746
5167 5171
1735 1737
2125 2128
1444 1447
1348 1352
6087 6090
1381 1384
1600 1601
5187 5190
2801 2802
8449 8450
9376 9377
4021 4024
2674 2676
490...

output:

8133

result:

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