Submission #737592

# Submission time Handle Problem Language Result Execution time Memory
737592 2023-05-07T12:03:44 Z vjudge1 Robots (APIO13_robots) C++17
0 / 100
63 ms 163840 KB
/*
Templete by norman/KNN-07
*/
#include <bits/stdc++.h>
using namespace std;
#define el '\n'
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define fi first
#define nd second
#define forinc(i, a, b) for (int i = a; i <= b; i++)
#define fordec(i, a, b) for (int i = a; i >= b; i--)
#define alle(x) (x).begin(), (x).end()
#define ralle(x) (x).rbegin(), (x).rend()
#define mms(a, v) memset(a, v, sizeof(a))
#define lwb(a, v) lower_bound(a.begin(), a.end(), v)
#define upb(a, v) upper_bound(a.begin(), a.end(), v)
typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef vector<bool> vb;
typedef unordered_set<char> chrset;
const string taskname = "";
const bool tc = false;

/*
APIO 2013 - Mirror Practice: https://vjudge.net/contest/557209

Submission links:
    - https://oj.uz/problem/view/APIO13_robots
    - https://dmoj.ca/problem/apio13p1

Editorial links:
    - https://bits-and-bytes.me/2020/06/25/APIO-2013-Robots/
    - https://www.chengrt.site/OI/2017/05/03/apio2013-robots/
*/

const int N = 1000;
char a[N][N];

// dp[i][j][A][B] = minimum cost to go to pos (i,j) by the (A,B) robot
int dp[N][N][10][10];

const vector<short> dx = {-1, 1, 0, 0},
                    dy = {0, 0, 1, -1};

void solve()
{
    mms(dp, 0x3f3f3f3f);
    int n, w, h;
    cin >> n >> w >> h;
    forinc(i, 1, h) forinc(j, 1, w) cin >> a[i][j];
    forinc(i, 1, h) forinc(j, 1, w)
    {
        short val = (a[i][j] - '0');
        if (val >= 1 && val <= 9)
            dp[i][j][val + 1][val + 1] = 0;
    }
    
}

int main()
{
    if (fopen((taskname + ".inp").c_str(), "r"))
    {
        freopen((taskname + ".inp").c_str(), "r", stdin);
        freopen((taskname + ".out").c_str(), "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tsc = 1;
    if (tc)
    {
        cin >> tsc;
    }
    while (tsc--)
    {
        solve();
        cout << el;
    }
}

Compilation message

robots.cpp: In function 'int main()':
robots.cpp:73:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   73 |         freopen((taskname + ".inp").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
robots.cpp:74:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |         freopen((taskname + ".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 63 ms 163840 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 63 ms 163840 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 63 ms 163840 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 63 ms 163840 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -