Submission #1295006

#TimeUsernameProblemLanguageResultExecution timeMemory
1295006Ice_manNavigation 2 (JOI21_navigation2)C++20
75 / 100
284 ms900 KiB
#include "Anna.h"
#include <bits/stdc++.h>

namespace
{

int FunctionExample(int r, int c, int K)
{
    return (r + c) % K + 1;
}

} // namespace

void Anna(int n, int k, std::vector<int> r, std::vector<int> c)
{
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
        {
            int rem = (i % 3) * 3 + (j % 3);

            if(rem >= k)
            {
                SetFlag(i, j, 14);
                continue;
            }

            int here = -1;

            if(abs(r[rem] - i) >= 2)
                if(r[rem] > i)
                    here = 12;
                else
                    here = 13;
            else if(abs(c[rem] - j) >= 2)
                if(c[rem] > j)
                    here = 10;
                else
                    here = 11;
            else
                here = (r[rem] - i + 1) * 3 + (c[rem] - j + 1) + 1;

            SetFlag(i, j, here);
        }



}
#include "Bruno.h"
#include <bits/stdc++.h>


#define X first
#define Y second

typedef std::pair <int , int> pii;

namespace
{

int variable_example = 1;

} // namespace

std::vector<int> Bruno(int k, std::vector<int> value)
{
    std::vector <std::vector <int> > here(3, std::vector <int>(3)), tt(3, std::vector <int> (3));
    for(int i = 0; i < 9; i++)
        here[i / 3][i % 3] = value[i];


    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++)
        {
            if(here[i][j] == 14 && here[i][(j + 1) % 3] == 14)
            {
                for(int i2 = 0; i2 < 3; i2++)
                    for(int j2 = 0; j2 < 3; j2++)
                        tt[i2][j2] = ((2 + i2 - i + 3) % 3) * 3 + ((1 + j2 - j + 3) % 3);
            }
        }

    std::vector <int> ret(k);
    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++)
            if(tt[i][j] < k)
            {
                pii nb;

                if(here[i][j] <= 9)
                {
                    nb.X = i + (here[i][j] - 1) / 3 - 1;
                    nb.Y = j + (here[i][j] - 1) % 3 - 1;

                    if(nb.Y > 1)
                        ret[tt[i][j]] = 0;
                    else if(nb.Y < 1)
                        ret[tt[i][j]] = 1;
                    else if(nb.X > 1)
                        ret[tt[i][j]] = 2;
                    else if(nb.X < 1)
                        ret[tt[i][j]] = 3;
                    else
                        ret[tt[i][j]] = 4;
                }
                else
                    ret[tt[i][j]] = here[i][j] - 10;
            }

    return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...