QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#102271 | #6308. Magic | jimmyywang | WA | 34ms | 3692kb | C++14 | 849b | 2023-05-02 20:20:07 | 2023-05-02 20:20:17 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define f(i,a,b) for(ll i=a;i<=b;i++)
inline ll rd(){
ll x=0,f=1;char c=getchar();
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c))x=x*10+c-'0',c=getchar();
return x*f;
}
#define d rd()
ll n,m;
ll l[5010],r[5010];
bitset<10010>vis;
ll ma[10010];
vector<ll>e[10010];
ll res;
bool dfs(ll u){
for(int i=0;i<e[u].size();i++){
ll v=e[u][i];
if(!vis[v]){vis[v]=1;
if(!ma[v]||dfs(ma[v])){
ma[v]=u;return 1;
}
}
}return 0;
}bool fl[10010];
int main(){
n=d;f(i,1,n)l[i]=d,r[i]=d,fl[r[i]]=1;
f(i,1,n)f(j,i+1,n)if(l[i]<l[j]&&l[j]<r[i]&&r[i]<r[j])e[r[i]].push_back(l[j]);
f(i,1,n*2)if(fl[i])vis.reset(),res+=dfs(i);
cout<<2*n-res;
return 0;
}
/*
5
2 3
6 7
1 9
5 10
4 8
*/
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3692kb
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: 34ms
memory: 3692kb
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:
9017
result:
wrong answer 1st numbers differ - expected: '8134', found: '9017'