結果
| 問題 | No.3664 Manhattan Circumcenter |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-30 16:26:33 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,254 bytes |
| 記録 | |
| コンパイル時間 | 2,308 ms |
| コンパイル使用メモリ | 349,908 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-08-30 16:26:39 |
| 合計ジャッジ時間 | 4,598 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
vector<pair<int,int>> a(3), ans, S;
for(auto &&[y, x] : a) cin >> y >> x;
sort(a.begin(), a.end());
do{
auto [y0, x0] = a[0];
auto [y1, x1] = a[1];
auto [y2, x2] = a[2];
if(y0 + x0 == y1 + x1 && y0 + x0 == y2 + x2){
cout << "-1\n";
return 0;
}
if(y0 + x0 == y1 + x1 && y0 - x0 == y2 - x2){
cout << "-1\n";
return 0;
}
if(y0 - x0 == y1 - x1 && y0 - x0 == y2 - x2){
cout << "-1\n";
return 0;
}
}while(next_permutation(a.begin(), a.end()));
do{
auto [y0, x0] = a[0];
auto [y1, x1] = a[1];
auto [y2, x2] = a[2];
int u0 = y0 + x0, v0 = y0 - x0;
int u1 = y1 + x1, v1 = y1 - x1;
int u2 = y2 + x2, v2 = y2 - x2;
int U = u0 + u1, V = v0 + v1;
S.emplace_back((U + V) / 2, (U - V) / 2);
U = u0 + u1, V = v0 + v2;
S.emplace_back((U + V) / 2, (U - V) / 2);
U = u0 + u2, V = v0 + v1;
S.emplace_back((U + V) / 2, (U - V) / 2);
U = u0 - u1, V = v0 + v1;
S.emplace_back((U + V) / 2, (U - V) / 2);
U = u0 + u1, V = v0 - v1;
S.emplace_back((U + V) / 2, (U - V) / 2);
U = u0 - u1, V = v0 + v2;
S.emplace_back((U + V) / 2, (U - V) / 2);
U = u0 + u1, V = v0 - v2;
S.emplace_back((U + V) / 2, (U - V) / 2);
U = u0 - u2, V = v0 + v1;
S.emplace_back((U + V) / 2, (U - V) / 2);
}while(next_permutation(a.begin(), a.end()));
auto f = [&](int y, int x, int p){
auto [y0, x0] = a[p];
return abs(y - y0) + abs(x - x0);
};
for(auto [y, x] : S){
if(f(y, x, 0) == f(y, x, 1) && f(y, x, 1) == f(y, x, 2)){
ans.emplace_back(y, x);
}
swap(y, x);
if(f(y, x, 0) == f(y, x, 1) && f(y, x, 1) == f(y, x, 2)){
ans.emplace_back(y, x);
}
}
sort(ans.begin(), ans.end());
ans.erase(unique(ans.begin(), ans.end()), ans.end());
cout << ans.size() << '\n';
for(auto [y, x] : ans) cout << y << ' ' << x << '\n';
}