QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673353#9221. Missing Boundariesucup-team191#RE 0ms0kbC++231.2kb2024-10-24 21:52:292024-10-24 21:52:29

Judging History

你现在查看的是最新测评结果

  • [2024-10-24 21:52:29]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-10-24 21:52:29]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int t,n,c;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>t;
	while (t--)
	{
		cin>>n>>c;
		vector<pair<int,pii>> v;
		int cm=0,ma=c;
		while (n--)
		{
			int l,r;
			cin>>l>>r;
			if (l==-1 && r==-1)
			{
				++cm;
				continue;
			}
			if (l==-1)
			{
				v.pb({r,{l,r}});
				--ma;
				continue;
			}
			if (r==-1)
			{
				v.pb({l,{l,r}});
				--ma;
				continue;
			}
			ma-=r-l+1;
			v.pb({l,{l,r}});
		}
		sort(all(v));
		bool ok=1;
		int mi=0;
		if (v[0].y.x!=-1 && v[0].y.x!=1) ++mi;
		if (v.back().y.y!=c && v.back().y.y!=-1) ++mi;
		for (int i=0;i<(int)v.size()-1;++i)
		{
			if (max(v[i].y.x,v[i].y.y)>=v[i+1].x)
			{
				ok=0;
				break;
			}
			if (v[i].y.y!=-1 && v[i+1].y.x!=-1 && v[i+1].y.x!=v[i].y.y+1) ++mi;
		}
		if (cm<mi || cm>ma) ok=0;
		if (ok) cout<<"TAK\n";
		else cout<<"NIE\n";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

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:


result: