이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "parks.h"
#include <bits/stdc++.h>
int construct_roads(std::vector<int> x, std::vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}else{
std::vector<int> u, v, a, b;
bool flag=true;
std::vector<int> p;
p=y;
std::vector<int> t(x.size(),0);
sort(p.begin(),p.end());
int m=p[0];
for(int i=1;i<x.size();i++){
if(p[i]%2==1 || p[i]-p[i-1]!=2){
flag=false;
break;
}
}
if(flag==true){
for(int i=0;i<x.size();i++){
t[(y[i]-m)/2]=i;
}
for(int i=0;i<x.size()-1;i++){
u.push_back(t[i]);
v.push_back(t[i+1]);
a.push_back(x[i]+1);
b.push_back(p[i]+1);
}
build(u, v, a, b);
return 1;
}else{
return 0;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i=1;i<x.size();i++){
| ~^~~~~~~~~
parks.cpp:22:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for(int i=0;i<x.size();i++){
| ~^~~~~~~~~
parks.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i=0;i<x.size()-1;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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |