QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#759484#6875. Chaos Beginwly09WA 207ms10144kbC++201.1kb2024-11-18 09:11:282024-11-18 09:11:37

Judging History

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

  • [2024-11-18 09:11:37]
  • 评测
  • 测评结果:WA
  • 用时:207ms
  • 内存:10144kb
  • [2024-11-18 09:11:28]
  • 提交

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);
  }
  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 (check(x, y)) {
      ans.emplace(x, y);
      if (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: 207ms
memory: 10144kb

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
2
-1299214 4042591
1299214 -4042591
2
-8741920 10415695
8741920 -10415695
2
-2229898 7623233
2229898 -7623233
2
-2396328 -13627890
2396328 13627890
3
-6349453 -7699267
0 0
6349453 7699267
3
-6444872 4551651
0 0
6444872 -4551651
2
-8530514 4791752
8530514 -4791752
3
...

result:

wrong answer 16th lines differ - expected: '2', found: '3'