提交记录 19739
提交时间 |
评测时间 |
2023-07-25 17:06:40 |
2023-07-25 17:06:51 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin>>q;
while(q--) {
int a[30];
memset(a,0,sizeof a);
int cnt=0,zhishu=0,ans=0,max=0;
bool flag=true;
int n;
cin>>n;
string str;
cin>>str;
if(str=="O(1)") ans=1;
else
for(int i=4; str[i]!=')'; i++)
ans=ans*10+str[i]-'0';
for(int i=1; i<=n; i++) {
string ch1="0",ch2="0",ch3="0",ch4="0",chh="0";
cin>>chh;
//cout<<"****CHH=="<<chh<<"****"<<endl;
//cin>>chh;
if(chh=="F") cnt++;//cnt用来计算F、E是否匹配,F就++,E就--
else if(chh=="E"&&cnt>0) cnt--,zhishu--,memset(a,0,sizeof a);//碰到E就清空变量
else if(chh=="E"&&cnt<=0) flag=false;//cout<<"****E的数量不匹配*****";//F和E不匹配,就false
if(chh=="F") cin>>ch2>>ch3>>ch4;
if(a[ch2[0]-'a']==0) a[ch2[0]-'a']++;
else flag=false;//cout<<"****i的字母不匹配*****";
if(ch2[0]!='n'&&ch3[0]>'0'&&ch3[0]<='9'&&ch4[0]=='n') zhishu++,max=(max,zhishu);
}
if(!flag||cnt!=0) cout<<"ERR"<<endl;
else if(max==0&&str=="O(1)") cout<<"Yes"<<endl;
else if(ans==max) cout<<"Yes"<<endl;
else if(ans!=max) cout<<"No"<<endl;//cout<<"***ans=="<<ans<<"****",cout<<"***zhishu=="<<max<<"****";
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 43.38 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #2 | 44.87 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #3 | 57.99 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #4 | 66.84 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #5 | 86.86 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #6 | 61.56 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #7 | 87.76 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #8 | 102.32 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #9 | 100.11 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #10 | 134.05 us | 36 KB | Wrong Answer | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-09-14 18:57:48 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠