QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#169118#7104. Halting Problemkjhhjki#Compile Error//C++201.7kb2023-09-09 12:41:092023-09-09 12:41:11

Judging History

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

  • [2023-09-09 12:41:11]
  • 评测
  • [2023-09-09 12:41:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define read() ({int x,c,f=1;while((c=getchar())<48||57<c)if(c=='-')f=-1;for(x=c^48;47<(c=getchar())&&c<58;)x=x*10+(c^48);x*f; })
const int N = 256 * (1e5 + 2);
bool vis[N];
struct
{
    int type, v, k;
} ins[N];
char s[10];
void solve()
{
    int n = read();
    for (int i = 1; i <= n; ++i)
    {
        scanf("%s", s);
        if (s[1] == 'd')
            ins[i] = {'d', read()};
        else
            ins[i] = {s[1], read(), read()};
    }
    memset(vis, 0, (n + 1) * 256);
    for (int i = 1, r = 0, des; i <= n; i = des)
    {
        if (vis[i<<8|r])
        {
            puts("No");
            return;
        }
        vis[i<<8|r]=1;
        des = i + 1;
        switch (ins[i].type)
        {
        case 'd':
            r = (r + ins[i].v) % 256;
            break;
        case 'e':
            if (r == ins[i].v)
                des = ins[i].k;
            break;
        case 'n':
            if (r != ins[i].v)
                des = ins[i].k;
            break;
        case 'l':
            if (r < ins[i].v)
                des = ins[i].k;
            break;
        case 'g':
            if (r > ins[i].v)
                des = ins[i].k;
            break;
        default:
            break;
        }
    }
    puts("Yes");
}
int main()
{
    for (int T = read(); T--;)
        solve();
    return 0;
}
/*
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

*/

Details

answer.code:8:1: error: extended character   is not valid in an identifier
    8 |     int type, v, k;
      | ^
answer.code:8:3: error: extended character   is not valid in an identifier
    8 |     int type, v, k;
      |   ^
answer.code:13:1: error: extended character   is not valid in an identifier
   13 |     int n = read();
      | ^
answer.code:13:3: error: extended character   is not valid in an identifier
   13 |     int n = read();
      |   ^
answer.code:14:1: error: extended character   is not valid in an identifier
   14 |     for (int i = 1; i <= n; ++i)
      | ^
answer.code:14:3: error: extended character   is not valid in an identifier
   14 |     for (int i = 1; i <= n; ++i)
      |   ^
answer.code:15:1: error: extended character   is not valid in an identifier
   15 |     {
      | ^
answer.code:15:3: error: extended character   is not valid in an identifier
   15 |     {
      |   ^
answer.code:16:1: error: extended character   is not valid in an identifier
   16 |         scanf("%s", s);
      | ^
answer.code:16:3: error: extended character   is not valid in an identifier
   16 |         scanf("%s", s);
      |   ^
answer.code:16:5: error: extended character   is not valid in an identifier
   16 |         scanf("%s", s);
      |     ^
answer.code:16:7: error: extended character   is not valid in an identifier
   16 |         scanf("%s", s);
      |       ^
answer.code:17:1: error: extended character   is not valid in an identifier
   17 |         if (s[1] == 'd')
      | ^
answer.code:17:3: error: extended character   is not valid in an identifier
   17 |         if (s[1] == 'd')
      |   ^
answer.code:17:5: error: extended character   is not valid in an identifier
   17 |         if (s[1] == 'd')
      |     ^
answer.code:17:7: error: extended character   is not valid in an identifier
   17 |         if (s[1] == 'd')
      |       ^
answer.code:18:1: error: extended character   is not valid in an identifier
   18 |             ins[i] = {'d', read()};
      | ^
answer.code:18:3: error: extended character   is not valid in an identifier
   18 |             ins[i] = {'d', read()};
      |   ^
answer.code:18:5: error: extended character   is not valid in an identifier
   18 |             ins[i] = {'d', read()};
      |     ^
answer.code:18:7: error: extended character   is not valid in an identifier
   18 |             ins[i] = {'d', read()};
      |       ^
answer.code:18:9: error: extended character   is not valid in an identifier
   18 |             ins[i] = {'d', read()};
      |         ^
answer.code:18:11: error: extended character   is not valid in an identifier
   18 |             ins[i] = {'d', read()};
      |           ^
answer.code:19:1: error: extended character   is not valid in an identifier
   19 |         else
      | ^
answer.code:19:3: error: extended character   is not valid in an identifier
   19 |         else
      |   ^
answer.code:19:5: error: extended character   is not valid in an identifier
   19 |         else
      |     ^
answer.code:19:7: error: extended character   is not valid in an identifier
   19 |         else
      |       ^
answer.code:20:1: error: extended character   is not valid in an identifier
   20 |             ins[i] = {s[1], read(), read()};
      | ^
answer.code:20:3: error: extended character   is not valid in an identifier
   20 |             ins[i] = {s[1], read(), read()};
      |   ^
answer.code:20:5: error: extended character   is not valid in an identifier
   20 |             ins[i] = {s[1], read(), read()};
      |     ^
answer.code:20:7: error: extended character   is not valid in an identifier
   20 |             ins[i] = {s[1], read(), read()};
      |       ^
answer.code:20:9: error: extended character   is not valid in an identifier
   20 |             ins[i] = {s[1], read(), read()};
      |         ^
answer.code:20:11: error: extended character   is not valid in an identifier
   20 |             ins[i] = {s[1], read(), read()};
      |           ^
answer.code:21:1: error: extended character   is not valid in an identifier
   21 |     }
      | ^
answer.code:21:3: error: extended character   is not valid in an identifier
   21 |     }
      |   ^
answer.code:22:1: error: extended character   is not valid in an identifier
   22 |     memset(vis, 0, (n + 1) * 256);
      | ^
answer.code:22:3: error: extended character   is not valid in an identifier
   22 |     memset(vis, 0, (n + 1) * 256);
      |   ^
answer.code:23:1: error: extended character   is not valid in an identifier
   23 |     for (int i = 1, r = 0, des; i <= n; i = des)
      | ^
answer.code:23:3: error: extended character   is not valid in an identifier
   23 |     for (int i = 1, r = 0, des; i <= n; i = des)
      |   ^
answer.code:24:1: error: extended character   is not valid in an identifier
   24 |     {
      | ^
answer.code:24:3: error: extended character   is not valid in an identifier
   24 |     {
      |   ^
answer.code:25:1: error: extended character ...