QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#652484#4569. Connect the PointsIllusionaryDominance#WA 1ms3636kbC++141.0kb2024-10-18 18:46:082024-10-18 18:46:08

Judging History

你现在查看的是最新测评结果

  • [2024-10-18 18:46:08]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3636kb
  • [2024-10-18 18:46:08]
  • 提交

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";

}

Details

Tip: Click on the bar to expand more detailed information

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)