| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 28103 | noobprogrammer | Towns (IOI15_towns) | C++14 | 163 ms | 25548 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towns.h"
#include <bits/stdc++.h>
using namespace std ;
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define vii vector<ii>
int from[105] , to[105] , dist[105][105] ;
vii len[1000010] ;
int hubDistance(int n, int sub) {
memset(dist , -1 , sizeof dist) ;
int mdist = -1 , opt = -1 , tmp ;
for(int i=0;i<n;i++){
tmp = getDistance(0 , i) ;
if(mdist < tmp){
mdist = tmp ;
opt = i ;
}
}
mdist = -1 ;
int nxt = -1 ;
for(int i=0;i<n;i++){
from[i] = getDistance(opt , i) ;
if(from[i] > mdist){
mdist = from[i] ;
nxt = i;
}
}
for(int i=0;i<n;i++) to[i] = getDistance(nxt , i ) ;
for(int i=1;i<=1000000;i++) len[i].clear() ;
int res = 1e9 ;
for(int i=0;i<n;i++){
if(i == nxt ||i == opt) continue ;
int ok = (from[i] + to[i] - mdist)/2 ;
int ln = from[i] - ok ;
len[ln].push_back({i , ok }) ;
res = min(res , max( mdist - ln , ln ) ) ;
}
if(sub <= 2) return res ;
if(sub == 4){
int sum = 1 ;
bool chk = 0 ;
for(int i=1;i<=mdist;i++){
if(len[i].empty()) continue ;
if(max(i , mdist - i) == res) {
if( (int)len[i].size() <= n/2 && sum<=n/2 && n - sum - (int)len[i].size() <= n/2 ) chk = 1 ;
}
sum += (int)len[i].size() ;
}
if(chk ) return res ;
else return -res ;
}
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
