QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#282325 | #1173. Knowledge Is... | Chendaqian | WA | 0ms | 3576kb | C++14 | 1.2kb | 2023-12-11 19:13:03 | 2023-12-11 19:13:04 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<algorithm>
#include<cmath>
#include<queue>
#define ll long long
#define db double
using namespace std;
const db eps=1e-6;
const ll lnf=1e18;
const int inf=0x3f3f3f3f;
ll read() {
ll o=0,w=1;char c=getchar();
while(c<'0'||c>'9') {if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9') {o=o*10+c-'0';c=getchar();}
return o*w;
}
void DEBUG(string TIPS,auto *BG,auto *ED) {
cout<<"\ndebug "<<TIPS<<" :\n";
for(auto *it=BG;it<ED;*it++) printf("%d : %d\n",it-BG,*it);
cout<<"\n";
}
namespace dada {
const int N=5e5+10;
int n,ans;
struct line {
int l,r;
};
line d[N];
priority_queue<int,vector<int>,greater<int> > q1,q2;
int Main() {
n=read();
for(int i=1;i<=n;i++) {
d[i].l=read();d[i].r=read();
}
sort(d+1,d+1+n,[&](line x,line y) {
return x.l<y.l;
});
for(int i=1;i<=n;i++) {
if(q1.empty()||q1.top()>d[i].l) {
if(!q2.empty()&&q2.top()<d[i].r) {
q1.push(q2.top());
q2.pop();
q2.push(d[i].r);
} else {
q1.push(d[i].r);
}
} else {
q1.pop();
q2.push(d[i].r);
}
}
cout<<q2.size();
return 0;
}
}
int main() {
int T=1;
while(T--) {dada::Main();}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
7 5 9 10 7 9 3 4 9 10 2 6 8 9 5 8
output:
3
result:
wrong output format Unexpected end of file - int32 expected