提交记录 47934
| 用户 | 题目 | 状态 | 得分 | 用时 | 内存 | 语言 | 代码长度 |
|---|---|---|---|---|---|---|---|
| jiegec | noi17b. 【NOI2017】蚯蚓排队 | Accepted | 100 | 554.887 ms | 95712 KB | C++17 | 3.40 KB |
| 提交时间 | 评测时间 |
|---|---|
| 2026-09-13 11:03:56 | 2026-09-13 11:04:06 |
// This code is AI-generated. (AI 生成的代码)
#include<sys/auxv.h>
#pragma GCC optimize("Ofast,unroll-loops")
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int k=50,mod=998244353;
int n,m,len,y[10000002],t[8][20000002];
long long ans;
char ch[10000002];
typedef struct{
int w,las,nex;
}P;
P p[200002];
struct DuckInfo {
unsigned long abi; const char *in; unsigned long in_size;
char *out; unsigned long out_limit, out_size;
char *err; unsigned long err_limit, err_size;
const char *IB; unsigned long IB_limit; char *OB; unsigned long OB_limit; unsigned long tsc;
} __attribute__((packed));
static const char *ip; static char *op;
int read()
{
const char *p = ip;
while ((unsigned)(*p - '0') > 9u && *p != '-') p++;
int w = 1;
if (*p == '-') { w = -1; p++; }
int data = 0;
while ((unsigned)(*p - '0') <= 9u) data = data * 10 + (*p++ - '0');
ip = p;
return data * w;
}
static void wr(long long v) {
if (v < 0) { *op++ = '-'; v = -v; }
char t[24]; int k = 0;
if (!v) t[k++] = '0';
while (v) { t[k++] = (char)('0' + v % 10); v /= 10; }
while (k) *op++ = t[--k];
*op++ = '\n';
}
int main()
{
struct DuckInfo *d = (struct DuckInfo *)getauxval(0x6b637564UL);
ip = d->in; op = d->out;
n=read();m=read();
for (int i=1;i<=n;i++)
{
p[i].w=read();p[i].las=p[i].nex=-1;
if (!t[p[i].w][0])t[p[i].w][0]=++len;
t[0][t[p[i].w][0]]++;
}
while(m--)
{
int u;
u=read();
if (u==1)
{
int a,b,c,root;bool u;
a=read();b=read();
p[a].nex=b;p[b].las=a;
for (int i=a;i!=-1;i=p[i].las)
{
c=u=root=0;
for (int j=i;c<k&&j!=-1;j=p[j].nex)
{
if (!t[p[j].w][root])
{
t[p[j].w][root]=++len;
if (t[7][root]==-1 || !t[p[j].w][t[7][root]])
t[7][len]=-1;
else t[7][len]=t[p[j].w][t[7][root]];
}
root=t[p[j].w][root];
if (j==b)u=1;t[0][root]+=u;
c++;
}
if (!u)break;
}
}
else if (u==2)
{
int a,b,c,root;bool u;
a=read();b=p[a].nex;
for (int i=a;i!=-1;i=p[i].las)
{
c=u=0;root=0;
for (int j=i;c<k&&j!=-1;j=p[j].nex)
{
root=t[p[j].w][root];
if (j==b)u=1;t[0][root]-=u;
c++;
}
if (!u)break;
}
p[a].nex=p[b].las=-1;
}
else
{
int a,l,root=0;ans=0;
{ while (*ip && (unsigned char)*ip <= 32u) ip++; char *cp = ch; while ((unsigned char)*ip > 32u) *cp++ = *ip++; *cp = 0; } a=read(); l=(int)strlen(ch);
for (int i=0;i<a;i++)
{
root=t[ch[i]-48][root];if (!root)goto ccj;
}
ans=t[0][root];
for (int i=a;i<l;i++)
{
root=t[7][root];if (root<0){ans=0;goto ccj;}
root=t[ch[i]-48][root];if (!root){ans=0;goto ccj;}
ans=ans*t[0][root]%mod;
}
ccj:wr(ans);
}
}
d->out_size = (unsigned long)(op - d->out);
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 21.89 us | 28 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #2 | 15.56 us | 40 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #3 | 8.467 ms | 64 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #4 | 158.08 us | 96 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #5 | 5.777 ms | 124 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #6 | 37.6 ms | 26 MB + 628 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #7 | 17.513 ms | 624 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #8 | 28.252 ms | 22 MB + 592 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #9 | 39.517 ms | 28 MB + 320 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #10 | 91.615 ms | 24 MB + 372 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #11 | 123.27 ms | 35 MB + 172 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #12 | 48.623 ms | 31 MB + 216 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #13 | 37.527 ms | 1 MB + 192 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #14 | 60.799 ms | 41 MB + 1012 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #15 | 70.908 ms | 45 MB + 576 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #16 | 222.2 ms | 45 MB + 540 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #17 | 262.086 ms | 55 MB + 88 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #18 | 193.869 ms | 84 MB + 912 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #19 | 219.473 ms | 93 MB + 336 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #20 | 53.67 ms | 23 MB + 244 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #21 | 78.483 ms | 2 MB + 340 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #22 | 141.492 ms | 78 MB + 16 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #23 | 149.062 ms | 79 MB + 380 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #24 | 510.044 ms | 84 MB + 956 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #25 | 554.887 ms | 93 MB + 480 KB | Accepted | Score: 4 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-14 15:46:48 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠