| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 25370 | gabrielsimoes | Palembang Bridges (APIO15_bridge) | C++14 | 0 ms | 2024 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<ll,ll> pll;
int main()
{
int m, n;
scanf("%d %d", &m, &n);
char a,c;
ll b,d, ans0 = 0;
vector<pll> v;
for (int i = 0; i < n; i++) {
scanf(" %c %lld %c %lld",&a, &b,&c, &d);
if (d < b) swap(b,d);
printf("%c %c %d %d\n", a, c,a,c);
if (a == c) ans0 += d - b;
else v.push_back(pll(b,d)), ans0++;
}
if (m == 1) {
vector<ll> all;
for (pll& p : v)
all.push_back(p.first), all.push_back(p.second);
sort(all.begin(), all.end());
ll x = all[all.size()/2 - 1];
for (ll y : all)
ans0 += abs(y - x);
printf("%lld\n", ans0);
return 0;
}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
