QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#896060 | #9221. Missing Boundaries | yzhang# | WA | 1ms | 3584kb | C++23 | 1.2kb | 2025-02-12 21:15:07 | 2025-02-12 21:15:08 |
Judging History
answer
#include<bits/stdc++.h>
#define N 200005
using namespace std;
int T,n,L,a[N],b[N];
vector< pair<int,pair<int,int> > >v;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>T;
while(T--){
cin>>n>>L;
int cnt=0;
v.clear();
for(int i=1;i<=n;++i){
cin>>a[i]>>b[i];
if(a[i]==-1&&b[i]==-1) ++cnt;
else if(a[i]==-1) v.push_back(make_pair(b[i],make_pair(b[i],0)));
else if(b[i]==-1) v.push_back(make_pair(a[i],make_pair(a[i],2)));
else v.push_back(make_pair(a[i],make_pair(b[i],1)));
}
v.push_back(make_pair(0,make_pair(0,1)));
v.push_back(make_pair(L+1,make_pair(L+1,1)));
sort(v.begin(),v.end());
int lb=0,rb=0,fl=1;
for(int i=1;i<(int)v.size();++i){
if(v[i-1].second.first>=v[i].first) fl=0;
if(v[i-1].second.second<=1&&v[i].second.second>=1) ++lb;
rb+=v[i].first-v[i-1].second.first-1;
}
if(fl){
if(lb<=cnt&&cnt<=rb) cout<<"TAK\n";
else cout<<"NIE\n";
}else
cout<<"NIE\n";
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3584kb
input:
3 4 51 1 -1 11 50 -1 -1 -1 10 3 2 -1 -1 -1 -1 -1 -1 2 3 1 2 2 3
output:
NIE NIE NIE
result:
wrong answer 1st lines differ - expected: 'TAK', found: 'NIE'