QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#540475#8940. Piggy Sortucup-team987#WA 1ms3640kbC++202.1kb2024-08-31 17:06:432024-08-31 17:06:44

Judging History

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

  • [2024-08-31 17:06:44]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3640kb
  • [2024-08-31 17:06:43]
  • 提交

answer

#if __INCLUDE_LEVEL__ == 0

#include __BASE_FILE__

void Solve() {
  int n, m;
  IN(n, m);
  vector x(m, pair(INT64_C(0), vector<int64_t>(n)));
  for (int t : Rep(0, m)) {
    for (int i : Rep(0, n)) {
      IN(x[t].second[i]);
      x[t].first += x[t].second[i];
    }
  }
  ranges::sort(x);

  vector<pair<int64_t, int>> v(n);
  for (int i : Rep(0, n)) {
    for (int j : Rep(0, n)) {
      bool ok = true;
      int64_t t1 = x[1].first - x[0].first;
      int64_t x1 = x[1].second[j] - x[0].second[i];
      for (int t : Rep(2, m)) {
        int64_t t2 = x[t].first - x[0].first;
        int64_t x2 = x[t].second[j] - x[0].second[i];
        if (t1 * x2 != t2 * x1) {
          ok = false;
          break;
        }
      }
      if (ok) {
        v[i] = {x1, i};
      }
    }
  }
  ranges::sort(v);

  vector<int> ans(n);
  for (int k : Rep(0, n)) {
    ans[v[k].second] = k + 1;
  }
  OUT(ans);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int t;
  IN(t);
  while (t--) {
    Solve();
  }
}

#elif __INCLUDE_LEVEL__ == 1

#include <bits/stdc++.h>

template <class T> concept Range = std::ranges::range<T> && !std::convertible_to<T, std::string_view>;
template <class T> concept Tuple = std::__is_tuple_like<T>::value && !Range<T>;

namespace std {

istream& operator>>(istream& is, Range auto&& r) {
  for (auto&& e : r) is >> e;
  return is;
}
istream& operator>>(istream& is, Tuple auto&& t) {
  apply([&](auto&... xs) { (is >> ... >> xs); }, t);
  return is;
}

ostream& operator<<(ostream& os, Range auto&& r) {
  auto sep = "";
  for (auto&& e : r) os << exchange(sep, " ") << e;
  return os;
}
ostream& operator<<(ostream& os, Tuple auto&& t) {
  auto sep = "";
  apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t);
  return os;
}

}  // namespace std

using namespace std;

#define Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__)
#define IN(...) cin >> forward_as_tuple(__VA_ARGS__)
#define OUT(...) cout << forward_as_tuple(__VA_ARGS__) << '\n'

#endif  // __INCLUDE_LEVEL__ == 1

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3640kb

input:

3
2 4
1 2
3 4
5 6
7 8
1 2
1
1
3 4
1 2 3
6 9 9
10 15 17
12 18 21

output:

1 2
1
3 1 2

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3640kb

input:

41
1 2
-19
9531
2 3
11 13
3175 4759
2211 3313
10 19
-54 -25 -19 -18 -1 3 61 63 85 88
-54 753 863 2397 3111 4649 4671 4756 5507 7762
-54 369 479 1245 1575 2345 2367 2452 2819 3922
-54 553 663 1797 2311 3449 3471 3556 4107 5762
-54 87 197 399 447 653 675 760 845 1102
-54 320 430 1098 1379 2051 2073 21...

output:

1
1 2
1 2 6 10 5 7 9 4 3 8
9 0 0 0 0 0 0 0 0
9 0 0 0 0 0 0 10 0 0
4 0 10 6 7 0 9 8 0 5
8 0 7 0 0 0 0 0
5 6 0 0 0 9 8 7 0 10
2 3 1 4
7 6 0 5 8 0 0 9 0
4 0 5 6 7 0 0 8 9
9 8 5 7 0 3 4 6 0
6 7 0 0 0 0 10 8 9 0
5 6 8 7 9 0 10 0 0 0
4 8 5 6 0 0 7 9 0
8 3 4 7 0 9 5 6 0
2 3 4 6 7 10 9 5 8 0
6 0 7 8 0 9 10 ...

result:

wrong answer 4th lines differ - expected: '8 7 5 9 2 1 6 3 4', found: '9 0 0 0 0 0 0 0 0'