QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#759489#6875. Chaos Beginwly09WA 603ms21812kbC++201.3kb2024-11-18 09:13:432024-11-18 09:13:44

Judging History

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

  • [2024-11-18 09:13:44]
  • 评测
  • 测评结果:WA
  • 用时:603ms
  • 内存:21812kb
  • [2024-11-18 09:13:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

struct hash_pairii {
  int64_t operator()(const pair<int, int> &pr) const {
    return (int64_t)(pr.first) << 32 | pr.second;
  }
};

void solve() {
  vector<pair<int, int>> v;
  unordered_multiset<pair<int, int>, hash_pairii> st;
  int n;
  cin >> n;
  for (int64_t i = 0; i < n << 1; ++i) {
    int64_t x, y;
    cin >> x >> y;
    st.emplace(x, y);
    v.emplace_back(x, y);
  }
  if ([&]() {
        for (const auto &pr : v)
          if (st.count(pr) & 1)
            return false;
        return true;
      }()) {
    cout << "1\n0 0\n";
  }
  set<pair<int64_t, int64_t>> ans;
  auto check = [&](int64_t x, int64_t y) -> bool {
    for (const auto &[a, b] : v) {
      if (!st.count({a + x, b + y}) && !st.count({a - x, b - y}))
        return false;
    }
    return true;
  };
  for (size_t i = 1; i < v.size(); ++i) {
    int64_t x = v[i].first - v[0].first;
    int64_t y = v[i].second - v[0].second;
    if (x || y && check(x, y)) {
      ans.emplace(x, y), ans.emplace(-x, -y);
    }
  }
  cout << ans.size() << '\n';
  for (const auto &[a, b] : ans)
    cout << a << ' ' << b << '\n';
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--)
    solve();
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 603ms
memory: 21812kb

input:

100
1
828748 -4793083
-4304195 -5463593
3
237233 -4112155
8020574 8746231
435013 -5934194
-864201 -1891603
1536447 -8154746
9319788 4703640
2
-8647149 5511912
94771 -4903783
8836691 -15319478
94771 -4903783
2
4374481 1876187
8834277 -13370279
6604379 -5747046
6604379 -5747046
2
274825 17829398
-4517...

output:

2
-5132943 -670510
5132943 670510
10
-9082555 -8815795
-7783341 -12858386
-1299214 4042591
-1101434 2220552
-197780 1822039
197780 -1822039
1101434 -2220552
1299214 -4042591
7783341 12858386
9082555 8815795
4
-17483840 20831390
-8741920 10415695
8741920 -10415695
17483840 -20831390
4
-4459796 152464...

result:

wrong answer 4th lines differ - expected: '2', found: '10'