Submission #1047269

#TimeUsernameProblemLanguageResultExecution timeMemory
1047269AbitoRobot Contest (IOI23_robot)C++17
18 / 100
79 ms6040 KiB
#include "robot.h"
#include <bits/stdc++.h>
#define elif else if
using namespace std;
//WSEN
void program_pulibot(){
    for (int i=-2;i<=4;i++){
        for (int j=-2;j<=4;j++){
            for (int k=-2;k<=4;k++){
                for (int l=-2;l<=4;l++){
                    for (int n=-2;n<=4;n++){
                        int c[5]={0};
                        if (j>=0) c[j]++;
                        if (k>=0) c[k]++;
                        if (l>=0) c[l]++;
                        if (n>=0) c[n]++;
                        if (k==-2 && l==-2){
                            if (j==3) set_instruction({i,j,k,l,n},1,'W');
                            elif (n==3) set_instruction({i,j,k,l,n},1,'N');
                            continue;
                        }
                        if (i==0){
                            if (c[0]){
                                if (j==0) set_instruction({i,j,k,l,n},3,'W');
                                elif (k==0) set_instruction({i,j,k,l,n},3,'S');
                                elif (l==0) set_instruction({i,j,k,l,n},3,'E');
                                elif (n==0) set_instruction({i,j,k,l,n},3,'N');
                            }
                            else{
                                if (j==3) set_instruction({i,j,k,l,n},2,'W');
                                elif (k==3) set_instruction({i,j,k,l,n},2,'S');
                                elif (l==3) set_instruction({i,j,k,l,n},2,'E');
                                elif (n==3) set_instruction({i,j,k,l,n},2,'N');
                            }
                            continue;
                        }
                        if (i==1){
                            if (c[2]){
                                if (j==2) set_instruction({i,j,k,l,n},1,'W');
                                elif (k==2) set_instruction({i,j,k,l,n},1,'S');
                                elif (l==2) set_instruction({i,j,k,l,n},1,'E');
                                elif (n==2) set_instruction({i,j,k,l,n},1,'N');
                            }
                            elif (c[3]){
                                if (j==3) set_instruction({i,j,k,l,n},1,'W');
                                elif (k==3) set_instruction({i,j,k,l,n},1,'S');
                                elif (l==3) set_instruction({i,j,k,l,n},1,'E');
                                elif (n==3) set_instruction({i,j,k,l,n},1,'N');
                            }
                            else set_instruction({i,j,k,l,n},1,'T');
                            continue;
                        }
                        if (i==2){
                            if (c[2]){
                                if (j==2) set_instruction({i,j,k,l,n},4,'W');
                                elif (k==2) set_instruction({i,j,k,l,n},4,'S');
                                elif (l==2) set_instruction({i,j,k,l,n},4,'E');
                                elif (n==2) set_instruction({i,j,k,l,n},4,'N');
                            }
                            elif (c[4]){
                                if (j==4) set_instruction({i,j,k,l,n},0,'W');
                                elif (k==4) set_instruction({i,j,k,l,n},0,'S');
                                elif (l==4) set_instruction({i,j,k,l,n},0,'E');
                                elif (n==4) set_instruction({i,j,k,l,n},0,'N');
                            }
                            else{
                                if (j==1) set_instruction({i,j,k,l,n},0,'W');
                                elif (k==1) set_instruction({i,j,k,l,n},0,'S');
                                elif (l==1) set_instruction({i,j,k,l,n},0,'E');
                                elif (n==1) set_instruction({i,j,k,l,n},0,'N');
                            }
                            continue;
                        }
                        if (i==3){
                            if (c[0]){
                                if (j==0) set_instruction({i,j,k,l,n},3,'W');
                                elif (k==0) set_instruction({i,j,k,l,n},3,'S');
                                elif (l==0) set_instruction({i,j,k,l,n},3,'E');
                                elif (n==0) set_instruction({i,j,k,l,n},3,'N');
                            }
                            elif (c[1]){
                                set_instruction({i,j,k,l,n},1,'H');
                            }
                            else{
                                if (j==3) set_instruction({i,j,k,l,n},2,'W');
                                elif (k==3) set_instruction({i,j,k,l,n},2,'S');
                                elif (l==3) set_instruction({i,j,k,l,n},2,'E');
                                elif (n==3) set_instruction({i,j,k,l,n},2,'N');
                            }
                            continue;
                        }
                        if (i==4){
                            if (c[2]){
                                if (j==2) set_instruction({i,j,k,l,n},4,'W');
                                elif (k==2) set_instruction({i,j,k,l,n},4,'S');
                                elif (l==2) set_instruction({i,j,k,l,n},4,'E');
                                elif (n==2) set_instruction({i,j,k,l,n},4,'N');
                            }
                            elif (c[4]){
                                if (j==4) set_instruction({i,j,k,l,n},0,'W');
                                elif (k==4) set_instruction({i,j,k,l,n},0,'S');
                                elif (l==4) set_instruction({i,j,k,l,n},0,'E');
                                elif (n==4) set_instruction({i,j,k,l,n},0,'N');
                            }
                            else{
                                if (j==1) set_instruction({i,j,k,l,n},0,'W');
                                elif (k==1) set_instruction({i,j,k,l,n},0,'S');
                                elif (l==1) set_instruction({i,j,k,l,n},0,'E');
                                elif (n==1) set_instruction({i,j,k,l,n},0,'N');
                            }
                        }
                    }
                }
            }
        }
    }return;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...