QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#652484 | #4569. Connect the Points | IllusionaryDominance# | WA | 1ms | 3636kb | C++14 | 1.0kb | 2024-10-18 18:46:08 | 2024-10-18 18:46:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
vector<pair<int,int>> a(3);
for(int i=0;i<3;++i) cin>>a[i].first>>a[i].second;
sort(a.begin(), a.end());
pair<long long, vector<tuple<int,int,int,int>>> ans={-1, vector<tuple<int,int,int,int>>()};
do
{
long long _ = 0;
vector<tuple<int,int,int,int>> v;
for(int i=0;i<2;++i)
{
_ += abs(a[i+1].first - a[i].first);
_ += abs(a[i+1].second - a[i].second);
if(a[i+1].first != a[i].first) v.push_back({a[i].first, a[i].second, a[i+1].first, a[i].second});
if(a[i+1].second != a[i].second) v.push_back({a[i+1].first, a[i].second, a[i+1].first, a[i+1].second});
}
if(ans.first==-1||ans.first>_) ans={_, v};
} while (next_permutation(a.begin(), a.end()));
cout << ans.second.size() << "\n";
for(auto [x, y, xx, yy] : ans.second) cout<<x<<" "<<y<<" "<<xx<<" "<<yy<<"\n";
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
1 1 3 5 8 6
output:
4 1 1 3 1 3 1 3 5 3 5 8 5 8 5 8 6
result:
ok Total length is 12
Test #2:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
1 1 2 2 3 3
output:
4 1 1 2 1 2 1 2 2 2 2 3 2 3 2 3 3
result:
ok Total length is 4
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3620kb
input:
1 1 2 3 3 2
output:
4 1 1 2 1 2 1 2 3 2 3 3 3 3 3 3 2
result:
wrong answer Jury found better solution (j=4 vs p=5)