# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108750 | tictaccat | Coin Collecting (JOI19_ho_t4) | C++14 | 203 ms | 72668 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;
const ll INF = 1e9;
const int MAX = 1000 + 10;
int N;
ll d0;
vector<vector<ll>> dp(MAX*2,vector<ll>(MAX*2,INF));
vector<pair<ll,ll>> p;
int main() {
cin >> N;
for (int i = 0; i < 2*N; i++) {
ll X,Y,x,y; cin >> X >> Y;
if (Y <= 1) y = 1;
else y = 2;
if (X <= 1) x = 1;
else if (1 < X && X < N) x = X;
else x = N;
p.push_back(make_pair(x,y));
d0 += abs(Y-y)+abs(X-x);
}
sort(p.begin(),p.end());
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |