Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
59454 pnpn111 2020 NK-S3-T3 C++ 运行超时 20 2000 MS 8916 KB 1510 2022-10-12 17:00:24

Tests(4/20):


#include <iostream> #include <cstdio> #include <vector> #include <cstring> using namespace std; inline int read() { int x=0,c=getchar(); while(c<48||c>57)c=getchar(); while(c>=48&&c<=57)x=(x<<3)+(x<<1)+(c&15),c=getchar(); return x; } const int maxn=100006; int n,m; vector<int>edge[maxn]; vector<int>t; bool w[maxn],runed[maxn]; void flash() { vector<int>tb=t; for(int i=0;i<tb.size();++i) { if(runed[tb[i]])continue; runed[tb[i]]=1; int u=tb[i]; for(int j=0;j<edge[u].size();++j) { int v=edge[u][j]; if(!w[v])w[v]=1,t.push_back(v); } } } int main() { //freopen("tgT3.in","r",stdin); //freopen("tgT3.out","w",stdout); n=read();m=read(); for(int i=1;i<n;++i) { int u=read(),v=read(); edge[u].push_back(v); edge[v].push_back(u); } t.clear(); int opt,x; for(int i=0;i<m;++i) { flash(); //printf("i=%d w[1]=%d\n",i,w[1]); //printf("t.size()=%d\nt:\n",t.size()); //for(int i=0;i<t.size();++i)printf("t[%d]=%d\n",i,t[i]); opt=read();x=read(); if(opt==1) w[x]=1,t.push_back(x); else if(opt==2) { t.clear(); memset(w,0,sizeof(w)); memset(runed,0,sizeof(runed)); } else if(opt==3) puts(w[x]?"wrxcsd":"orzFsYo"); } return 0; }


测评信息: