이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
struct fountain{
int x, y, ind;
bool operator<(auto&other){
return make_pair(x, y)<make_pair(other.x, other.y);
}
};
int construct_roads(vector<int> x, vector<int> y) {
int n = x.size();
vector<fountain> v;
for(int i = 0; i < n; i++){
v.push_back({y[i], x[i], i}); // FORDITOTT KOORDINATAK!!!!!4!!1!!!14!44!!!
}
sort(v.begin(), v.end());
int el = v[0].x;
vector<int> ru, rv, ra, rb;
for(int i = 1; i < n; i++){
if(v[i-1].x == v[i].x){
ru.push_back(v[i-1].ind);
rv.push_back(v[i].ind);
ra.push_back(v[i].x+1);
rb.push_back(3);
} else if(v[i-1].y == v[i].y && v[i].x-v[i-1].x == 2){
ru.push_back(v[i-1].ind);
rv.push_back(v[i].ind);
ra.push_back(v[i].x-1);
rb.push_back(v[i].y == 2 ? 1 : 5);
el = v[i].x;
}
if(i > 1){
if(v[i-2].x == v[i].x){
ru.push_back(v[i-2].ind);
rv.push_back(v[i].ind);
ra.push_back(v[i].x+1);
rb.push_back(3);
} else if(v[i-2].y == v[i].y && v[i].x-v[i-2].x == 2){
ru.push_back(v[i-2].ind);
rv.push_back(v[i].ind);
ra.push_back(v[i].x-1);
rb.push_back(v[i].y == 2 ? 1 : 5);
el = v[i].x;
}
}
}
if(el == v.back().x){
build(rv, ru, rb, ra);
return 1;
} else {
return 0;
}
}
컴파일 시 표준 에러 (stderr) 메시지
parks.cpp:8:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
8 | bool operator<(auto&other){
| ^~~~
# | 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... |