QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#200106 | #7104. Halting Problem | y_kx_b | AC ✓ | 25ms | 6128kb | C++14 | 3.1kb | 2023-10-04 15:24:20 | 2023-10-04 15:24:21 |
Judging History
answer
// Problem: C - Halting Problem
// Contest: Virtual Judge - The 2nd Universal Cup. Stage 1: Qingdao
// URL: https://vjudge.net/contest/583075#problem/C
// Memory Limit: 253 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
#define gc getchar
#define itn int
#define x first
#define y second
#define eb emplace_back
#define em emplace
#define pb push_back
#define db double
#define y1 yy1_yyds
using namespace std; typedef long long ll; typedef unsigned long long ull;
// https://www.luogu.com.cn/discuss/522581 About "const"
ll read() {
ll x = 0; short fh = 1; char ch = gc();
while (!isdigit(ch)) {
if (ch == '-') fh = -1;
if (ch < 10) exit(0);
ch = gc();
}
while (isdigit(ch))
x = x * 10 + (ch ^ 48), ch = gc();
return fh * x;
}
#ifndef ONLINE_JUDGE
void debug() {cerr << "\n";}
template<typename Typ1> void debug(Typ1 arg) {cerr << arg << "\n";}
template<typename Typ1, typename ...Typ2> void debug(Typ1 arg, Typ2 ...args) {
cerr << arg << " ", debug(args...);
}
#else
void debug() {}
template<typename Typ1> void debug(Typ1 arg) {}
template<typename Typ1, typename ...Typ2> void debug(Typ1 arg, Typ2 ...args) {}
#endif
void writeln(ll arg) {printf("%lld\n", arg);}
template<typename ...Typ2> void writeln(ll arg, Typ2 ...args) {
printf("%lld ", arg), writeln(args...);
}
typedef pair <int, int> pii; typedef pair <ll, ll> pll;
// const char Y_E_S[] = "YES", N__O[] = "NO";
const char Y_E_S[] = "Yes", N__O[] = "No";
// #define infinite_testcase
#define multiple_testcase
#define output_Yes_No
const int DUST = 327, N = 14514, M = -1;
bool vis[N][262];
unsigned int act[N][3];
bool major(int Case = 1) {
int n = read();
for(int i = 1; i <= n; i++) {
string s; cin >> s;
if(s[0] == 'a') /* 多测不清空导致的。*/act[i][0] = 0, act[i][1] = read();
else {
act[i][1] = read(), act[i][2] = read();
switch(s[1]) {
case 'e': act[i][0] = 1; break;
case 'n': act[i][0] = 2; break;
case 'l': act[i][0] = 3; break;
case 'g': act[i][0] = 4; break;
}
}
}
for(int i = 1; i <= n; i++) for(int j = 0; j < 256; j++) vis[i][j] = 0;
unsigned char r = 0;
for(int i = 1; i <= n; i++) {
if(vis[i][r]) return 0;
vis[i][r] = 1;
switch(act[i][0]) {
case 0: r += act[i][1]; break;
case 1: if(r == act[i][1]) i = act[i][2] - 1; break;
case 2: if(r != act[i][1]) i = act[i][2] - 1; break;
case 3: if(r < act[i][1]) i = act[i][2] - 1; break;
case 4: if(r > act[i][1]) i = act[i][2] - 1; break;
}
}
return Case ^= Case ^ Case;
}
void initial_function(int argc, char **argv) {
**argv = argc; /* <- place_holder
you won't give up no matter what happens, will you?
code time:
---
qwq
*/
}
signed main(int argc, char **argv) {
initial_function(argc, argv);
int Case = 1, Maxcase = 1;
for (
#ifdef multiple_testcase
Maxcase = read()
#endif
;
#ifndef infinite_testcase
Case <= Maxcase
#endif
; Case++)
#ifdef output_Yes_No
puts(major(Case) ? Y_E_S : N__O);
#else
major(Case);
#endif
return DUST ^ 0x147;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3396kb
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: 25ms
memory: 6128kb
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