QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#251847 | #4393. Snatch Groceries | PZheng | WA | 129ms | 5060kb | C++14 | 656b | 2023-11-15 10:40:56 | 2023-11-15 10:40:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct node
{
int p,x;
bool operator<(node nod)const
{
if(p!=nod.p)
return p<nod.p;
else
return x<nod.x;
}
};
void solve()
{
int n,cnt=0,now=0;
cin>>n;
vector<node> nods(n*2);
for(int i=0;i<n;i++){
cin>>nods[i*2].p>>nods[i*2+1].p;
nods[i*2].x=1;
nods[i*2+1].x=-1;
}
sort(nods.begin(),nods.end());
for(int i=0;i<nods.size();i++){
if(nods[i].x==1&&now==1)
break;
if(nods[i].x==1){
now++;
}
if(nods[i].x==-1){
now--;
cnt++;
}
}
cout<<cnt<<endl;
}
int main()
{
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 129ms
memory: 5060kb
input:
5 3 1 2 3 4 5 6 3 1 2 3 4 4 5 100000 263324740 263324748 920719069 920719077 82595123 82595132 765796214 765796222 621714954 621714959 77799324 77799332 278166427 278166428 375391536 375391545 856576804 856576812 512542774 512542781 829984452 829984457 302442403 302442404 779239984 779239986 1189173...
output:
3 3 275 5575 10000
result:
wrong answer 2nd lines differ - expected: '1', found: '3'