提交记录 15661
提交时间 |
评测时间 |
2021-01-22 10:48:16 |
2021-01-22 10:48:19 |
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int t,n,ans,st[100010][2],use[26];
char BuF[1<<26],*InF=BuF,p;
int read(int &x){
for(;*InF<33||*InF=='^';++InF);
for(x=0;47<*InF&&*InF<58;x=(x<<3)+(x<<1)+(*InF++^48));
return(x);
}
char read(){
for(;*InF<33;++InF);
return(*InF++);
}
void readln(){
while(*InF++!='\n');
}
int calc(int n){
int re=0,mx=0,p=0,a,b;
st[0][0]=0;
for(int i=1;i<=n;readln(),++i){
if(re==0){
if(read()=='F'){
if(use[st[++st[0][0]][0]=read()-97]++){
re=-1;
}else{
if(!read(a)){
read();
if(!read(b)){
st[st[0][0]][1]=0;
}else{
st[st[0][0]][1]=-1;
}
}else{
if(!read(b)){
st[st[0][0]][1]=1;
}else{
st[st[0][0]][1]=(a<=b)-1;
}
}
if(st[st[0][0]-1][1]==-1){
st[st[0][0]][1]=-1;
}else if(st[st[0][0]][1]==1){
mx=max(mx,++p);
}
}
}else{
--use[st[st[0][0]][0]];
if(st[st[0][0]--][1]==1){
--p;
}
if(st[0][0]<0){
re=-1;
}
}
}
}
return(re<0||st[0][0]?-1:mx);
}
int main(){
fread(BuF,1,1<<26,stdin);
for(read(t);t;--t){
memset(use,0,sizeof(use));
read(n);read();read();
if(read()=='1'){
ans=0;
}else{
read(ans);
}
readln();
int sum=calc(n);
printf(sum<0?"ERR\n":sum==ans?"Yes\n":"No\n");
}
fclose(stdin);
fclose(stdout);
return(0);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 35.14 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 42.95 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 42.67 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 37.55 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 39.09 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 36.31 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 37.19 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 38.97 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 39.89 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #10 | 44.1 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:20:42 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠