# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
585458 | mnng | Palembang Bridges (APIO15_bridge) | C++14 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int maxN = 1e5+1;
int k, n;
struct Tbridge
{
char a, b;
ll x, y;
bool chk;
}p[maxN];
ll ans = 0;
void Input()
{
vector<ll> v;
cin >> k >> n;
for(int i = 1; i <= n; i++)
{
cin >> p[i].a >> p[i].x >> p[i].b >> p[i].y;
if(p[i].a == p[i].b)
{
ans += abs(p[i].y - p[i].x);
p[i].chk = false;
}
else
{
v.pb(p[i].x);
v.pb(p[i].y);
p[i].chk = true;
}
}
/* sort(v.begin(), v.end());
if(k == 1)
{
ll h = v.size()/2;
h = v[h];
for(int i = 1; i <= n; i++)
if(p[i].chk)
ans += abs(h - p[i].x) + abs(h - p[i].y) + 1;
cout << ans;
return;
}
/* int res = v.size()/3;
int h = v[res], h2 = v[res*2];
for(int i = 1; i <= n; i++)
if(p[i].chk)
ans += min(abs(h - p[i].x) + abs(h - p[i].y) + 1, abs(h2 - p[i].x) + abs(h2 - p[i].y) + 1);
cout << ans;*/
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
Input();
}
컴파일 시 표준 에러 (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... |