QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#157114 | #7104. Halting Problem | ucup-team918# | AC ✓ | 54ms | 24620kb | C++17 | 3.4kb | 2023-09-02 14:58:12 | 2023-09-02 15:01:18 |
Judging History
answer
//Was yea ra,rra yea ra synk sphilar yor en me exec hymme METAFALICA waath!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define ll long long
#define ull unsigned ll
#define lowbit(x) (x&(-x))
#define djq 1000000007
const double eps=1e-10;
const short sint=0x3f3f;
const int inf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;
const double alpha=0.73;
const double PI=acos(-1);
inline void file(){
freopen("1.in","r",stdin);
freopen("1.out","w",stdout);
}
char buf[1<<21],*p1=buf,*p2=buf;
inline int getc(){
return p1==p2&&(p2=(p1=buf)+fread(buf,1,(1<<20)+5,stdin),p1==p2)?EOF:*p1++;
}
//#define getc getchar
inline ll read(){
rg ll ret=0,f=0;char ch=getc();
while(!isdigit(ch)){if(ch==EOF)exit(0);if(ch=='-')f=1;ch=getc();}
while(isdigit(ch)){ret=ret*10+ch-48;ch=getc();}
return f?-ret:ret;
}
inline void rdstr(char* s){
char ch=getc();
while(ch<33||ch>126) ch=getc();
while(ch>=33&&ch<=126) (*s++)=ch,ch=getc();
}
#define ep emplace
#define epb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define it iterator
#define mkp make_pair
#define naive return 0*puts("Yes")
#define angry return 0*puts("No")
#define fls fflush(stdout)
#define rep(i,a) for(rg int i=1;i<=a;++i)
#define per(i,a) for(rg int i=a;i;--i)
#define rep0(i,a) for(rg int i=0;i<=a;++i)
#define per0(i,a) for(rg int i=a;~i;--i)
#define szf sizeof
typedef vector<int> vec;
typedef pair<int,int> pii;
struct point{ int x,y; point(int x=0,int y=0):x(x),y(y) {} inline bool operator<(const point& T)const{ return x^T.x?x<T.x:y<T.y; }; };
inline int ksm(int base,int p){int ret=1;while(p){if(p&1)ret=1ll*ret*base%djq;base=1ll*base*base%djq,p>>=1;}return ret;}
inline void pls(int& x,const int k){ x=(x+k>=djq?x+k-djq:x+k); }
inline int add(const int a,const int b){ return a+b>=djq?a+b-djq:a+b; }
inline void sub(int& x,const int k){ x=(x-k<0?x-k+djq:x-k); }
inline int inc(const int a,const int b){ return a<b?a-b+djq:a-b; }
inline void ckmn(int& x,const int k){ x=(k<x?k:x); }
inline void ckmx(int& x,const int k){ x=(k>x?k:x); }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int B=255;
int n,m,to[10001*256+5],vis[10001*256+5];
inline int id(int i,int j){ return j*(n+1)+i; }
char str[15];
signed mian(){
n=read(); m=(n+1)*256;
rep(i,m) vis[i]=to[i]=0;
rep(i,n){
rdstr(str); const int v=read();
if(str[0]=='a'){
for(rg int j=0;j<256;++j) to[id(i,j)]=id(i+1,(j+v)&B);
}else{
const int k=read();
if(str[1]=='e'){
for(rg int j=0;j<256;++j)
if(j==v) to[id(i,j)]=id(k,j);
else to[id(i,j)]=id(i+1,j);
}else if(str[1]=='n'){
for(rg int j=0;j<256;++j)
if(j==v) to[id(i,j)]=id(i+1,j);
else to[id(i,j)]=id(k,j);
}else if(str[1]=='l'){
for(rg int j=0;j<256;++j)
if(j<v) to[id(i,j)]=id(k,j);
else to[id(i,j)]=id(i+1,j);
}else if(str[1]=='g'){
for(rg int j=0;j<256;++j)
if(j>v) to[id(i,j)]=id(k,j);
else to[id(i,j)]=id(i+1,j);
}else assert(0);
}
}
int x=id(1,0);
while(x&&!vis[x]) vis[x]=1,x=to[x];
for(rg int j=0;j<256;++j) if(vis[id(n+1,j)]) return 0*puts("Yes");
puts("No");
return 0;
}
signed main(){
//file();
int _=read();
while(_--) mian();
return 0;
}
/*
*/
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 7840kb
input:
4 2 add 1 blt 5 1 3 add 252 add 1 bgt 252 2 2 add 2 bne 7 1 3 add 1 bne 252 1 beq 252 1
output:
Yes Yes No No
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 54ms
memory: 24620kb
input:
1117 8 bgt 51 8 add 75 add 115 bne 40 3 beq 213 6 bgt 210 4 blt 228 7 bgt 60 2 6 bne 130 3 add 33 bne 74 4 blt 73 6 blt 63 5 bne 138 2 6 beq 131 2 bgt 90 3 add 127 bgt 195 1 blt 244 6 bne 20 3 3 add 53 bne 122 1 blt 251 2 9 add 102 add 161 bne 26 2 blt 5 8 beq 76 3 add 119 bgt 196 3 bne 239 8 blt 15...
output:
No Yes Yes No No Yes Yes No Yes No No No No Yes No No Yes No Yes No No Yes No No No Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes Yes No No No No No Yes No Yes No No No Yes No No No No No Yes No Yes Yes Yes No Yes No Yes No Yes No No No No Yes No No Yes No No Yes No No No Yes Yes Yes Yes No Y...
result:
ok 1117 lines
Extra Test:
score: 0
Extra Test Passed