Aborted / IOT trap.
查看原帖
Aborted / IOT trap.
292748
wrkwrkwrk楼主2022/8/29 19:17

https://www.luogu.com.cn/record/85453005

#include<bits/stdc++.h>
#include<sstream>
#define MAX 0x3fffffffffffffffL
#define int long long
#define ipairs pair<int,int>
#define endl '\n'
using namespace std;
template<class a,class b>
b con_type(a aa,b &bb){
	 stringstream pa;
	 pa<<aa;
	 b asdq;
	 pa>>bb;
}
inline int read(){
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
#define right riri
#define left lele 
//这里是防止CE的
int left=-MAX,usel=0,right=MAX,user=0;
signed main(){
	int n=read();
	char q=getchar();
	while(n--){
		string p;
		cin>>p;
		int y;
		if(p[2]=='='){
			con_type(p.substr(3),y);
			if(p[1]=='<'){
				if(y<right){
					user=1;
					right=y;
				}
			}else{
				if(y>left){
					usel=1;
					left=y;
				}
				
			}
		} else{
			con_type(p.substr(2),y);
			if(p[1]=='<'){
				if(y<=right){
					user=0;
					right=y;
				}
			}else{
				if(y>=left){
					usel=0;
					left=y;
				}
				
			}
			
		}
		
	}
	if(right<left||right==left&&!(usel&&user)){
		cout<<"No Answer!";
	}else if(right==left){
		cout<<q<<'='<<right;
	}else{
		if(left!=-MAX){
			if(right==MAX){
				cout<<q<<'>';
				if(usel)cout<<'=';
				cout<<left;
				return 0;
			}else{
				cout<<left<<'<';
				if(usel)cout<<'=';
			}
			
		}
		cout<<q;
		if(right!=MAX){
			cout<<'<';
			if(user)cout<<'=';
			cout<<right;
		}
		
	}
	return 0;
}

如题,全RE

2022/8/29 19:17
加载中...