# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161285 | pr3pony | Coin Collecting (JOI19_ho_t4) | C++14 | 3 ms | 632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
const int N = 1087;
const ll inf = 9e18;
pii p[N];
ll f(int i,int x,int y)
{
return abs(x-p[i].F) + abs(y-p[i].S);
}
ll dp[N][N];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
ll ans = 0;
int n;
cin >> n;
for (int i = 1; i <= 2*n; ++i) {
int x,y;
cin >> x >> y;
if (x < 1) ans += 1 - x, x = 1;
if (x > n) ans += x - n, x = n;
if (y < 1) ans += 1 - y, y = 1;
if (y > 2) ans += y - 2, y = 2;
p[i] = {x, y};
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |