提交记录 31274
| 提交时间 |
评测时间 |
| 2026-08-14 01:10:13 |
2026-08-14 01:10:19 |
#include <cstdio>
int main() {
int t;
scanf("%d", &t);
char outbuf[512]; int outlen = 0;
while (t--) {
int L;
char comp[32];
scanf("%d %s", &L, comp);
int expw = 0;
if (comp[2] == 'n') {
for (char *p = comp + 4; *p != ')'; ++p) expw = expw * 10 + (*p - '0');
}
int stk_var[128], stk_isn[128], stk_isdead[128], stk_contrib[128];
int top = 0;
int used[128] = {0};
int err = 0;
int dead = 0;
int cur = 0, maxc = 0;
for (int i = 0; i < L; ++i) {
char c;
scanf(" %c", &c);
if (c == 'F') {
char var, xs[16], ys[16];
scanf(" %c %s %s", &var, xs, ys);
int vi = (int)var;
int xnum = (xs[0] >= '0' && xs[0] <= '9');
int ynum = (ys[0] >= '0' && ys[0] <= '9');
int this_isdead = 0, this_isn = 0;
if (!xnum && ynum) this_isdead = 1;
else if (xnum && !ynum) this_isn = 1;
else if (xnum && ynum) {
int xv = 0, yv = 0;
for (char *p = xs; *p; ++p) xv = xv * 10 + (*p - '0');
for (char *p = ys; *p; ++p) yv = yv * 10 + (*p - '0');
if (xv > yv) this_isdead = 1;
}
if (used[vi]) err = 1;
used[vi] = 1;
int contributes = this_isn && (dead == 0);
stk_var[top] = vi;
stk_isn[top] = this_isn;
stk_isdead[top] = this_isdead;
stk_contrib[top] = contributes;
++top;
if (this_isdead) ++dead;
if (contributes) { ++cur; if (cur > maxc) maxc = cur; }
} else {
if (top == 0) err = 1;
else {
--top;
used[stk_var[top]] = 0;
if (stk_contrib[top]) --cur;
if (stk_isdead[top]) --dead;
}
}
}
if (top != 0) err = 1;
if (err) { outbuf[outlen++]='E'; outbuf[outlen++]='R'; outbuf[outlen++]='R'; }
else if (maxc == expw) { outbuf[outlen++]='Y'; outbuf[outlen++]='e'; outbuf[outlen++]='s'; }
else { outbuf[outlen++]='N'; outbuf[outlen++]='o'; }
outbuf[outlen++]='\n';
}
fwrite(outbuf, 1, outlen, stdout);
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 14.02 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #2 | 9.86 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #3 | 12.44 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #4 | 18.02 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #5 | 22.96 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #6 | 17.14 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #7 | 25.61 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #8 | 38.08 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #9 | 33.47 us | 16 KB | Accepted | Score: 10 | 显示更多 |
| Testcase #10 | 47.13 us | 16 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-12 09:41:39 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠