| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 139165 | ibrahim001 | 철로 (IOI14_rail) | C++14 | 600 ms | 98576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include <bits/stdc++.h>
#define intt long long
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
using namespace std;
const int inf = 1e9;
int i,j;
int dis[5005][5005];
bool l[5005];
bool used[5005];
void findLocation(int N, int first, int location[], int stype[])
{
location[0]=first;
stype[0]=1;
if ( N == 1 )
return;
int n=N;
for ( i = 0; i < n; i++ )
{
for ( j = i+1; j < n; j++ )
{
dis[i][j] = dis[j][i] = getDistance(i,j);
}
}
int best,minn=inf;
for ( i = 1; i < n; i++ )
{
if ( dis[0][i] < minn )
{
minn = dis[i][0];
best=i;
}
}
location[best] = location[0]+minn;
stype[best] = 2;
for ( i = 1; i < n; i++ )
{
if ( i == best )
continue;
if ( dis[i][best] < dis[i][0] )
{
if ( dis[i][best] < dis[best][0] )
{
location[i] = location[best]-dis[best][0];
stype[i] = 1;
continue;
}
l[i] = true;
}
}
vector<pii>v;
for ( i = 1; i < n; i++ )
{
if ( !l[i] || used[i] || i == best )
continue;
v.pb({dis[best][i],i});
}
if ( !v.empty() )
{
sort(v.begin(),v.end());
int last = v[0].S;
location[last]=location[best]-dis[best][last];
stype[last]=1;
bool flag=false;
for ( pii i : v )
{
if ( !flag )
{
flag= true;
continue;
}
if ( dis[best][i.S] == dis[best][last]+dis[last][i.S] )
{
stype[i.S] = 2;
location[i.S]=location[last]+dis[last][i.S];
}
else
{
last = i.S;
location[i.S] = location[best]-dis[best][i.S];
stype[i.S]=1;
}
}
}
v.clear();
for ( i = 1; i < n; i++ )
{
if ( !l[i] && i != best && !used[i] )
{
v.pb({dis[i][0],i});
}
}
if ( !v.empty() )
{
sort(v.begin(),v.end());
int last = v[0].S;
location[last]=location[0]+dis[last][0];
stype[last] = 2;
bool flag = false;
for ( pii i : v )
{
if ( !flag )
{
flag = true;
continue;
}
if ( dis[i.S][0] == dis[i.S][last]+dis[last][i.S] )
{
location[i.S] = location[last]-dis[last][i.S];
stype[i.S]=1;
}
else
{
last = i.S;
location[i.S] = location[0]+dis[i.S][0];
stype[i.S] = 2;
}
}
}
}
컴파일 시 표준 에러 (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... | ||||
