QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#163613#7123. Robot ContestLynkcatJudging//C++203.2kb2023-09-04 12:36:582024-04-21 00:16:38

Judging History

你现在查看的是测评时间为 2024-04-21 00:16:38 的历史记录

  • [2024-04-28 07:02:37]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:206ms
  • 内存:4992kb
  • [2024-04-21 00:19:30]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:209ms
  • 内存:5048kb
  • [2024-04-21 00:16:38]
  • 管理员手动重测本题所有提交记录
  • 测评结果:Judging
  • 用时:212ms
  • 内存:5044kb
  • [2023-09-04 12:36:59]
  • 评测
  • 测评结果:0
  • 用时:212ms
  • 内存:5044kb
  • [2023-09-04 12:36:58]
  • 提交

answer

#include<bits/stdc++.h>
#include "robot.h"
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
// #define int ll
// #define N 
using namespace std;
namespace 
{
    int s[4];
    string val="WSENHT";
}
inline int rev(int x)
{
    return ((x-2)^4)+2;
}
inline int rl(int x)
{
    return (x-2)&3;
}
inline int sta(int x)
{
    if (x<2) return 2;
    return (x-2)>3;
}
void work(int k)
{
    if (k==4)
    {
        if (s[1]==-2&&s[2]==-2)
        {
            int o=0,p=1;
            for (int i=0;i<4;i++)
                if (s[i]==0) p=0;
            if (p)
            {
                for (int i=0;i<4;i++)
                    if (s[i]>0) o=i;
                for (int j=2;j<=9;j++)
                    set_instruction((poly){j,s[0],s[1],s[2],s[3]},1,val[o]);
                return;
            }
        }
        if (s[0]==-2&&s[3]==-2)
        {
            for (int j=2;j<=9;j++)
            {
                int o=4;
                for (int i=0;i<4;i++)
                    if (s[i]==1) o=i;
                if (o!=4)
                {
                    set_instruction((poly){j,s[0],s[1],s[2],s[3]},1,val[5]);
                } else
                {
                    int nxt=4;
                    for (int i=0;i<4;i++)
                        if (s[i]==0||sta(s[i])==(sta(j)^1)) nxt=i;
                    if (nxt!=4)
                    {
                        set_instruction((poly){j,s[0],s[1],s[2],s[3]},j,val[nxt]);
                    } else
                    {
                        int nxt=4;
                        for (int i=0;i<4;i++)
                            if (sta(s[i])==sta(j)) nxt=i;
                        if (nxt!=4)
                            set_instruction((poly){j,s[0],s[1],s[2],s[3]},rev(j),val[nxt]);
                    }
                }
            }
            int o=4;
            for (int i=0;i<4;i++)
                if (s[i]==0) o=i;
            set_instruction((poly){0,s[0],s[1],s[2],s[3]},2,val[o]);
            return;
        }
        {
            int o=4,op=4;
            for (int i=0;i<4;i++)
                if (s[i]==1) o=i^2;
            if (o!=4)
            {
                for (int j=2;j<=9;j++)
                    set_instruction((poly){j,s[0],s[1],s[2],s[3]},1,val[rl(j)]);
                return;
            }
        }
        for (int j=2;j<=9;j++)
        {
            int o=sta(s[rl(j)]);
            int nxt=4;
            for (int i=0;i<4;i++)
                if (s[i]==0||sta(s[i])==(o^1)&&rl(s[i])==(i^2)) nxt=i;
            if (nxt==4) nxt=rl(j);
            set_instruction((poly){j,s[0],s[1],s[2],s[3]},
            (rl(j)^(o*4))+2,val[nxt]);
        }
        int fa=0;
        for (int i=0;i<4;i++)
            if (s[i]>0)
                fa=i;
        set_instruction((poly){0,s[0],s[1],s[2],s[3]},(fa^(sta(s[fa])*4))+2,val[fa]);
        return;
    }
    for (int i=-2;i<=9;i++)
    {
        s[k]=i;
        work(k+1);
    }
}
void program_pulibot()
{
    int mx=9;
    work(0);
}