QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#181787 | #7184. Transport Pluses | USP_USP_USP# | WA | 0ms | 3808kb | C++20 | 1.9kb | 2023-09-17 00:28:04 | 2023-09-17 00:28:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define pb push_back
void dbg_out() { cerr << endl; }
template <typename H, typename... T>
void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); }
#define dbg(...) //{ cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); }
constexpr int N = 102;
void solve() {
int n, t; cin >> n >> t;
int xh, yh, xe, ye;
cin >> xh >> yh >> xe >> ye;
int dx = abs(xe - xh), dy = abs(ye - yh);
double ans = sqrt((double)dx * dx + dy * dy);
string path = "1\n0 " + to_string(xe) + " " + to_string(ye) + "\n";
vector<pair<int,int>> plus(n);
vector<int> dh(n), de(n);
for(auto &[x, y]: plus) cin >> x >> y;
for(int i=0;i<n;i++) {
auto [x, y] = plus[i];
dh[i] = min(abs(xh - x), abs(yh - y));
de[i] = min(abs(xe - x), abs(ye - y));
}
for(int i=0;i<n;i++) for(int j=0;j<n;j++) {
double d = dh[i] + de[j] + t + t * (i != j);
if(d < ans) {
dbg(d);
path = to_string(3 + (i != j)) + "\n";
string first;
{
first += "0 ";
auto [x, y] = plus[i];
if(abs(xh - x) < abs(yh - y)) {
first += to_string(x) + " " + to_string(yh) + "\n";
} else {
first += to_string(xh) + " " + to_string(y) + "\n";
}
}
string last;
{
last += "1 ";
auto [x, y] = plus[j];
if(abs(xe - x) < abs(ye - y)) {
last += to_string(x) + " " + to_string(ye) + "\n";
} else {
last += to_string(xe) + " " + to_string(y) + "\n";
}
}
string mid;
if(i != j) {
mid = "1 " + to_string(plus[i].first) + " " + to_string(plus[j].second) + "\n";
}
dbg(first, mid, last);
ans = d;
path += first + mid + last;
path += "0 " + to_string(xe) + " " + to_string(ye) + "\n";
}
}
cout << ans << '\n';
cout << path << '\n';
}
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
cout << fixed << setprecision(5);
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
1 2 1 1 5 3 6 2
output:
4.00000 3 0 1 2 1 5 2 0 5 3
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3808kb
input:
2 1 1 1 6 1 1 3 6 3
output:
2.00000 4 0 1 1 1 1 3 1 6 1 0 6 1
result:
wrong answer step 3: target (6.000000, 1.000000) not on plus (1.000000, 3.000000)