Submission #940291

# Submission time Handle Problem Language Result Execution time Memory
940291 2024-03-07T07:37:15 Z Ice_man Robots (APIO13_robots) C++14
0 / 100
0 ms 344 KB
#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <assert.h>

#define maxn 75
#define maxlog 20
#define INF 1000000010
#define mod 998244353
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cout<<"passed"<<endl;

#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")

using namespace std;


pair <int , int> r[10];


char c[15][15];

int n , m;
int br;

void read()
{
    cin >> n >> m >> br;

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        {
            cin >> c[i][j];

            if(c[i][j] >= '1' && c[i][j] <= '9')
                r[c[i][j] - '1'] = {i , j};
        }

    if(r[1].X != r[2].X && r[1].Y != r[2].Y)
    {
        cout << -1 << endl;
        ///assert(false);
        return;
    }

    if(r[1].X == r[2].X)
    {
        cout << abs(r[1].Y - r[2].Y) << endl;
        return;
    }

    if(r[1].Y == r[2].Y)
    {
        cout << abs(r[1].X - r[2].X) << endl;
        return;
    }

}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    read();


    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -