| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 43490 | Fated001 | Palembang Bridges (APIO15_bridge) | C++14 | 3 ms | 696 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
pair<long long,long long> P[5005];
long long pos[100005];
int main()
{
int k,n;
scanf("%d %d",&k,&n);
if(k==2) assert(0);
long long out=0;
int cnt=0,c=0;
for(int i=1;i<=n;i++)
{
long long a,b;
char s1[2],s2[2];
scanf("%s %lld %s %lld",s1,&a,s2,&b);
if(s1[0]==s2[0]) out+=abs(b-a);
else
{
pos[++cnt]=a;
pos[++cnt]=b;
P[++c]={a,b};
}
}
long long mn=LLONG_MAX;
for(int i=1;i<=cnt;i++)
{
long long tmp=0;
for(int j=1;j<=c;j++)
tmp+=abs(pos[i]-P[j].first)+1+abs(pos[i]-P[j].second);
mn=min(mn,tmp);
}
printf("%lld\n",out+mn);
}
컴파일 시 표준 에러 (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... | ||||
