Submission #571012

# Submission time Handle Problem Language Result Execution time Memory
571012 2022-06-01T03:26:03 Z ibm2006 Navigation 2 (JOI21_navigation2) C++17
0 / 100
20 ms 1168 KB
#include<bits/stdc++.h>
#include "Anna.h"
using namespace std;
typedef int ll;
void Anna(ll N, ll K, vector<ll> R, vector<ll> C) {
   ll x,y,z,w,n,k,i,j,a[400][400],b[3][3]={},c[1100]={},t,l;
   vector<ll> u,v;
   pair<ll,ll> p[7]={{-1,-1},{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1}};
   n=N;
   k=7;
   for(i=0;i<400;i++)
    for(j=0;j<400;j++)
    a[i][j]=0;
    v=R;  u=C;
    for(i=0;i<k;i++)
    {
        v[i]++;
        u[i]++;
    }
    x=-1;  y=-1;
   for(i=0;i<k;i++)
    b[(v[i]+2+2-p[i].first)%3][(u[i]+2+2-p[i].second)%3]=1;
   for(i=0;i<3;i++)
    {for(j=0;j<3;j++)
   {
       if(b[i][j]==0)
       {
           x=i;  y=j;
          // printf("%lld %lld\n",x,y);
           break;
       }
   }
   if(x>=0)
    break;
   }

   x-=3;  y-=3;
   for(i=x;i<=n;i+=3)
   {
       for(j=y;j<=n;j+=3)
       {
           if(i>=1&&j>=1)
           a[i][j]=13;
       }
   }
   for(l=0;l<7;l++)
   {
       z=x+p[l].first;
       w=y+p[l].second;
       for(i=z;i<=n;i+=3)
        for(j=w;j<=n;j+=3)
       {
           if(i<1||j<1)
           {
               continue;
           }
           if((i+1)==v[l]&&(j+1)==u[l])
           {
               a[i][j]=5;
           }
           else if((i+1)==v[l]&&(j)==u[l])
           {
               a[i][j]=6;
           }
           else if((i+1)==v[l]&&(j-1)==u[l])
           {
               a[i][j]=7;
           }
           else if((i)==v[l]&&(j+1)==u[l])
           {
               a[i][j]=8;
           }
           else if((i)==v[l]&&(j)==u[l])
           {
               a[i][j]=9;
           }
           else if((i)==v[l]&&(j-1)==u[l])
           {
               a[i][j]=10;
           }
           else if((i-1)==v[l]&&(j+1)==u[l])
           {
               a[i][j]=11;
           }
           else if((i-1)==v[l]&&(j)==u[l])
           {
               a[i][j]=12;
           }
           else if((i-1)==v[l]&&(j-1)==u[l])
           {
               a[i][j]=13;
           }
           else if((j-2)>=u[l])
           {
               a[i][j]=2;
           }
           else if((j+2)<=u[l])
           {
               a[i][j]=1;
           }
           else if((i-2)>=v[l])
           {
               a[i][j]=4;
           }
           else if((i+2)<=v[l])
           {
               a[i][j]=3;
           }
       }
   }
for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
    c[a[i][j]]=1;
for(i=1;i<=12;i++)
{
    if(c[i]==0)
    {
        t=i;
        break;
    }
}
z=x-3;  w=y-4;
for(i=z;i<=n;i+=3)
    for(j=w;j<=n;j+=3)
{
    if(i>=1&&j>=1)
    a[i][j]=t;

}
for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
{
    if(a[i][j]>t)
        a[i][j]--;
}
for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
    SetFlag(i-1,j-1,a[i][j]);
}
#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;
typedef int ll;
vector<ll> Bruno(ll K,vector<ll> value) {
ll x,y,i,j,n,k,a[110][110],z,w,t,l,x1,y1;
k=7;
pair<ll,ll> p[7]={{2,2},{2,0},{2,1},{0,1},{1,1},{1,0},{1,2}};
vector<ll> v;
v.resize(7);
n=3;
for(i=0;i<(n*n);i++)
    a[i/3][i%3]=value[i];
for(i=0;i<3;i++)
{for(j=0;j<3;j++)
{
    if(a[i][j]==12)
    {
       x=i;  y=j;

    }
}
}
    t=a[(x)%3][(y+2)%3];
    for(i=0;i<3;i++)
        for(j=0;j<3;j++)
    {
        if(a[i][j]>=t)
            a[i][j]++;
    }
    for(l=0;l<k;l++)
    {
        z=(x+p[l].first)%3;
        w=(y+p[l].second)%3;
        x1=z;  y1=w;
        if(a[z][w]==1)
        {
            v[l]=0;
            continue;
        }
        else if(a[z][w]==2)
        {
            v[l]=1;
            continue;
        }
        else if(a[z][w]==3)
        {
            v[l]=2;
            continue;
        }
        else if(a[z][w]==4)
        {
            v[l]=3;
            continue;
        }
        else if(a[z][w]==5)
        {
            x1++;  y1++;
        }
        else if(a[z][w]==6)
        {
            x1++;
        }
        else if(a[z][w]==7)
        {
            x1++;  y1--;
        }
        else if(a[z][w]==8)
        {
            y1++;
        }
        else if(a[z][w]==9)
        {

        }
        else if(a[z][w]==10)
        {
            y1--;
        }
        else if(a[z][w]==11)
        {
            x1--;  y1++;
        }
        else if(a[z][w]==12)
        {
            x1--;
        }
        else if(a[z][w]==13)
        {
            x1--;  y1--;
        }
        if(x1==1&&y1==1)
        {
            v[l]=4;
            continue;
        }
        if(x1==1)
        {
            if(y1>1)
            {
                v[l]=0;
            }
            else
                v[l]=1;
        }
        else
        {
            if(x1>1)
            {
                v[l]=2;
            }
            else
                v[l]=3;
            continue;
        }
    }
    return v;
}

Compilation message

Anna.cpp: In function 'void Anna(ll, ll, std::vector<int>, std::vector<int>)':
Anna.cpp:11:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   11 |    for(i=0;i<400;i++)
      |    ^~~
Anna.cpp:14:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   14 |     v=R;  u=C;
      |     ^
Anna.cpp:127:12: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
  127 |     a[i][j]=t;
      |     ~~~~~~~^~

Bruno.cpp: In function 'std::vector<int> Bruno(ll, std::vector<int>)':
Bruno.cpp:34:13: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |         w=(y+p[l].second)%3;
      |           ~~^~~~~~~~~~~~~
Bruno.cpp:33:13: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |         z=(x+p[l].first)%3;
      |           ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1068 KB Output is correct
2 Correct 19 ms 1120 KB Output is correct
3 Correct 19 ms 1168 KB Output is correct
4 Correct 19 ms 1168 KB Output is correct
5 Incorrect 8 ms 840 KB Wrong Answer [7]
6 Halted 0 ms 0 KB -