이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n';
#define ll long long int
const int N = 3e5+10;
int construct_roads(std::vector<int> x, std::vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
int n = x.size();
vector<int> u, v, a, b;
vector<pair<int, int>> F;
for(int i = 0; i < n; ++i) F.pb({y[i], i});
sort(all(F));
for(int i = 0; i < n - 1; ++i){
if(F[i + 1].first - F[i].first > 2){
return 0;
}
u.pb(F[i].second);
v.pb(F[i + 1].second);
a.pb(1);
b.pb(F[i].first+F[i+1].first>>1);
}
build(u, v, a, b);
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:30:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
30 | b.pb(F[i].first+F[i+1].first>>1);
# | 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... |