QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#760279#9730. Elevator IIygkingCompile Error//C++141.4kb2024-11-18 15:58:262024-11-18 15:58:27

Judging History

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

  • [2024-11-18 15:58:27]
  • 评测
  • [2024-11-18 15:58:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define long long int
const int N=1e5+10;
struct stu{
	int l,r,place;
}a[N],b[N],c[N];

bool cmp1(stu a,stu b)
{
	if(a.l!=b.l) 
		return a.l>b.l;
	return a.r>b.r;
}

bool cmp2(stu a,stu b)
{
	if(a.l!=b.l) 
		return a.l<b.l;
	return a.r<b.r;
}

int main(){
	int T;
	cin >> T;
	while(T--)
	{
		int n,f,x,y,temp=0,j1=1,j2=1,maxx=0,ans=0,maxx2=0;
		cin >> n >> f;
		temp=f;
		for(int i=1;i<=n;i++)
		{
			cin >> c[i].l >> c[i].r ;
			c[i].place=i;
			ans += (y - x);
			maxx = max(maxx,x);
		}	
		
		sort(c+1,c+1+n,cmp2);
		for(itn i=1;i<=n;i++)
		{
			if(c[i].l<=f)
			{
				f = ;
			}
			else break;
		}
		
		
		
	//	cout << ans << endl; 
		
		sort(b+1,b+j1,cmp2);
		sort(a+1,a+j2,cmp1);
		
		bool fun = false;
		if(f<maxx2)
			f = maxx2,fun = true;
		
		if(maxx > f)
		{
			for(int i=1;i<j1;i++)
			{
				ans += (b[i].l-f);
				cout << b[i].l <<' ' <<f << endl;
				f = b[i].r;
				if(f>=maxx)
					break;		
			}		
		}
		
		cout << ans << endl;
		
		if(fun)
		{
			for(int i=1;i<j2;i++)
				cout << a[i].place <<' ';
			for(int i=1;i<j1;i++)
				cout << b[i].place <<' ';
			cout << endl;			
		}
		else
		{
			for(int i=1;i<j1;i++)
				cout << b[i].place <<' ';
			for(int i=1;i<j2;i++)
				cout << a[i].place <<' ';
			cout << endl;		
		}


		
	}

詳細信息

answer.code: In function ‘int main()’:
answer.code:40:21: error: ‘itn’ was not declared in this scope; did you mean ‘int’?
   40 |                 for(itn i=1;i<=n;i++)
      |                     ^~~
      |                     int
answer.code:40:29: error: ‘i’ was not declared in this scope
   40 |                 for(itn i=1;i<=n;i++)
      |                             ^
answer.code:44:37: error: expected primary-expression before ‘;’ token
   44 |                                 f = ;
      |                                     ^
answer.code:93:10: error: expected ‘}’ at end of input
   93 |         }
      |          ^
answer.code:23:11: note: to match this ‘{’
   23 | int main(){
      |           ^