提交记录 13202


用户 题目 状态 得分 用时 内存 语言 代码长度
mariowong noip17b. 【NOIP2017】时间复杂度 Runtime Error 0 64.956 ms 60 KB C++ 1.82 KB
提交时间 评测时间
2020-07-28 23:01:04 2020-08-01 03:06:21
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define pbb pair<bool,bool>
#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define xmod (ll)(1e9+7) 
#define hmod 1286031825167LL
using namespace std;

int t,n,sum,now,len,num;
string comp,f,s;
char fe,va;
bool gg;
stack<pair<int,char>  > st;
bool a[35];
void cal_now(){
	if (comp.length() == 4)
	now=0;
	else
	{
		now=0; len=comp.length();
		for (int j=4;j<len;j++){
			if (comp[j] < '0' || comp[j] > '9')
			break;
			now*=10;
			now+=comp[j]-'0';
		}
	}
	for (int i=0;i<26;i++){
		a[i]=false;
	}
}
int str_val(string r){
	int lenn=r.length(),numm=0;
	for (int i=0;i<lenn;i++){
		numm*=10;
		num+=r[i]-'0';
	}
}
int main(){	
	ios::sync_with_stdio(false);
//	freopen("complexity.in","r",stdin);
//	freopen("complexity.out","w",stdout); 
	cin >> t;
	for (int i=1;i<=t;i++){
		cin >> n >> comp; gg=false;
		cal_now(); sum=0;
		for (int j=1;j<=n;j++){
			cin >> fe;
		//	cout << "nowgg:" << gg << "\n";
			if (fe == 'F'){
				cin >> va >> f >> s;
				if (a[va-'a'])
				gg=true;
				if (gg)
				goto out;
				a[va-'a']=true;
				if (s[0] == 'n')
				st.push(mp(1,va));
				else
				if (f[0] == 'n')
				st.push(mp(-100000,va));
				else
				{
					if (str_val(f) <= str_val(s))
					st.push(mp(0,va));
					else
					st.push(mp(-100000,va));
				}
			}
			else
			{
				if (st.empty())
				gg=true;
				if (gg)
				goto out;
				a[st.top().y-'a']=false;
				num=st.top().x; st.pop();
				if (num < 0);
				else
				if (!st.empty())
				st.top().x+=num;
				else
				sum=max(sum,num);
			}
			out:;
		}
		if (!st.empty() || gg)
		cout << "ERR\n";
		else
		if (sum == now)
		cout << "Yes\n";
		else
		cout << "No\n";
		while (!st.empty()){
			st.pop();
		}
	}
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #164.955 ms60 KBRuntime ErrorScore: 0

Testcase #264.956 ms56 KBRuntime ErrorScore: 0

Testcase #364.951 ms56 KBRuntime ErrorScore: 0

Testcase #464.948 ms60 KBRuntime ErrorScore: 0

Testcase #564.952 ms60 KBRuntime ErrorScore: 0

Testcase #664.951 ms60 KBRuntime ErrorScore: 0

Testcase #764.951 ms60 KBRuntime ErrorScore: 0

Testcase #864.95 ms60 KBRuntime ErrorScore: 0

Testcase #964.95 ms60 KBRuntime ErrorScore: 0

Testcase #1064.951 ms60 KBRuntime ErrorScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-03-24 18:34:46 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠