이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "citymapping.h"
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define N 1005
long long dis[N][N],dis1[N],ma,id,last,last_node;
vector<pair<long long,long long>> v;
void find_roads(int n,int q,int a[], int b[],int w[]){
int i,j;
if(q==500000){
for(i=1;i<=n;i++)for(j=i+1;j<=n;j++)dis[i][j]=dis[j][i]=get_distance(i,j);
}
else if(q==12000){
for(i=2;i<=n;i++)dis1[i]=get_distance(1,i);
for(i=1;i<=n;i++)if(dis1[i]>ma)ma=dis1[i],id=i;
for(i=1;i<=n;i++)if(i!=id)v.push_back({get_distance(id,i),i});
sort(v.begin(),v.end());
last=0;
last_node=id;
for(i=0;i<v.size();i++){
a[i]=last_node;
b[i]=v[i].second;
w[i]=v[i].first-last;
last=v[i].first;
last_node=v[i].second;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
citymapping.cpp: In function 'void find_roads(int, int, int*, int*, int*)':
citymapping.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for(i=0;i<v.size();i++){
| ~^~~~~~~~~
# | 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... |