답안 #797943

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
797943 2023-07-30T07:38:38 Z Oyster Minerals (JOI19_minerals) C++17
40 / 100
14 ms 2312 KB
#include "minerals.h"
#include <vector>
#include <utility>

std::vector<std::pair<int, int>> ans;

void DC(const std::vector<int> &v) {
  int N = v.size() >> 1;
  if (N == 1) return ans.push_back({v[0], v[1]});
  std::vector<int> vl, vr;
  for (const int &i : v) {
    if (Query(i) <= N >> 1) vl.push_back(i);
    else {
      Query(i);
      vr.push_back(i);
    }
  }
  for (const int &i : vl) Query(i);
  DC(vl); DC(vr);
}

void Solve(int N) {
  ans.reserve(N);
  std::vector<int> v(N << 1);
  for (int i = 0; i < v.size(); i++) v[i] = i + 1;
  DC(v);
  for (const auto &p : ans)
    Answer(p.first, p.second);
}

Compilation message

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:25:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for (int i = 0; i < v.size(); i++) v[i] = i + 1;
      |                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 2 ms 464 KB Output is correct
4 Correct 5 ms 672 KB Output is correct
5 Correct 9 ms 1088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 464 KB Output is correct
8 Correct 5 ms 672 KB Output is correct
9 Correct 9 ms 1088 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 936 KB Output is correct
12 Correct 13 ms 1144 KB Output is correct
13 Correct 8 ms 1204 KB Output is correct
14 Correct 8 ms 1060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 464 KB Output is correct
8 Correct 5 ms 672 KB Output is correct
9 Correct 9 ms 1088 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 936 KB Output is correct
12 Correct 13 ms 1144 KB Output is correct
13 Correct 8 ms 1204 KB Output is correct
14 Correct 8 ms 1060 KB Output is correct
15 Incorrect 14 ms 2312 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 464 KB Output is correct
8 Correct 5 ms 672 KB Output is correct
9 Correct 9 ms 1088 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 936 KB Output is correct
12 Correct 13 ms 1144 KB Output is correct
13 Correct 8 ms 1204 KB Output is correct
14 Correct 8 ms 1060 KB Output is correct
15 Incorrect 14 ms 2312 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 464 KB Output is correct
8 Correct 5 ms 672 KB Output is correct
9 Correct 9 ms 1088 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 936 KB Output is correct
12 Correct 13 ms 1144 KB Output is correct
13 Correct 8 ms 1204 KB Output is correct
14 Correct 8 ms 1060 KB Output is correct
15 Incorrect 14 ms 2312 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 464 KB Output is correct
8 Correct 5 ms 672 KB Output is correct
9 Correct 9 ms 1088 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 936 KB Output is correct
12 Correct 13 ms 1144 KB Output is correct
13 Correct 8 ms 1204 KB Output is correct
14 Correct 8 ms 1060 KB Output is correct
15 Incorrect 14 ms 2312 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 464 KB Output is correct
8 Correct 5 ms 672 KB Output is correct
9 Correct 9 ms 1088 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 936 KB Output is correct
12 Correct 13 ms 1144 KB Output is correct
13 Correct 8 ms 1204 KB Output is correct
14 Correct 8 ms 1060 KB Output is correct
15 Incorrect 14 ms 2312 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 464 KB Output is correct
8 Correct 5 ms 672 KB Output is correct
9 Correct 9 ms 1088 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 936 KB Output is correct
12 Correct 13 ms 1144 KB Output is correct
13 Correct 8 ms 1204 KB Output is correct
14 Correct 8 ms 1060 KB Output is correct
15 Incorrect 14 ms 2312 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -