QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#162487#7104. Halting Problemucup-team1209#AC ✓15ms4016kbC++201.5kb2023-09-03 13:27:052023-09-03 13:27:05

Judging History

你现在查看的是最新测评结果

  • [2023-09-03 13:27:05]
  • 评测
  • 测评结果:AC
  • 用时:15ms
  • 内存:4016kb
  • [2023-09-03 13:27:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,y,x) for (int i=(y);i>=(x);i--)
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
#define templ template<typename T>
templ bool chkmin(T &x,T y){return x>y?x=y,1:0;}
templ bool chkmax(T &x,T y){return x<y?x=y,1:0;}
void file() {
    #ifdef zqj
    freopen("a.in","r",stdin);
    #endif
}
typedef long long ll;
#define sz 10101

int n;
int type[sz],w[sz],t[sz];
bitset<256>vis[sz];

void work() {
    cin>>n;
    rep(i,1,n) vis[i].reset();
    rep(i,1,n) {
        string s; cin>>s>>w[i];
        if (s[0]=='a') type[i]=0;
        else {
            cin>>t[i];
            if (s[1]=='e') type[i]=1;
            else if (s[1]=='n') type[i]=2;
            else if (s[1]=='l') type[i]=3;
            else type[i]=4;
        }
    }
    int v=0,l=1;
    while (233) {
        if (l==n+1) break;
        if (vis[l][v]) {
            cout<<"No\n";
            return;
        }
        vis[l][v]=1;
        if (type[l]==0) v+=w[l],v&=255,++l;
        else if (type[l]==1) l=(v==w[l]?t[l]:l+1);
        else if (type[l]==2) l=(v!=w[l]?t[l]:l+1);
        else if (type[l]==3) l=(v<w[l]?t[l]:l+1);
        else if (type[l]==4) l=(v>w[l]?t[l]:l+1);
    }
    cout<<"Yes\n";
}

int main() {
    file();
    ios::sync_with_stdio(false), cin.tie(0);
    int T; cin>>T;
    while (T--) work();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3664kb

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: 15ms
memory: 4016kb

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