답안 #967176

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
967176 2024-04-21T12:18:52 Z Soumya1 Minerals (JOI19_minerals) C++17
90 / 100
34 ms 4040 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int last = 0;
bool ask(int x) {
  int nw = Query(x);
  bool g = (last != nw);
  last = nw;
  return g;
}
void solve(vector<int> a, vector<int> b, bool f) {
  if (a.size() == 1) {
    Answer(a[0], b[0]);
    return;
  }
  int n = a.size();
  int mid = n / 2;
  vector<int> la, lb, ra, rb;
  for (int i = 0; i < n; i++) {
    if (i < mid) ask(b[i]), lb.push_back(b[i]);
    else rb.push_back(b[i]);
  }
  for (int i : a) {
    if (la.size() == mid) ra.push_back(i);
    else if (ra.size() == n - mid) la.push_back(i);
    else if (f) {
      if (ask(i)) ra.push_back(i);
      else la.push_back(i);
    } else {
      if (ask(i)) la.push_back(i);
      else ra.push_back(i);
    }
  }
  solve(la, lb, f ^ 1);
  solve(ra, rb, f);
}
void Solve(int N) {
  vector<int> a, b;
  for (int i = 1; i <= 2 * N; i++) {
    if (ask(i)) a.push_back(i);
    else b.push_back(i);
  }
  solve(a, b, 0);
}

Compilation message

minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>, bool)':
minerals.cpp:24:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     if (la.size() == mid) ra.push_back(i);
      |         ~~~~~~~~~~^~~~~~
minerals.cpp:25:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |     else if (ra.size() == n - mid) la.push_back(i);
      |              ~~~~~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 5 ms 856 KB Output is correct
5 Correct 11 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 516 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1492 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1136 KB Output is correct
12 Correct 11 ms 1620 KB Output is correct
13 Correct 12 ms 1428 KB Output is correct
14 Correct 8 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 516 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1492 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1136 KB Output is correct
12 Correct 11 ms 1620 KB Output is correct
13 Correct 12 ms 1428 KB Output is correct
14 Correct 8 ms 1620 KB Output is correct
15 Correct 34 ms 3044 KB Output is correct
16 Correct 29 ms 3048 KB Output is correct
17 Correct 22 ms 3644 KB Output is correct
18 Correct 22 ms 3104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 516 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1492 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1136 KB Output is correct
12 Correct 11 ms 1620 KB Output is correct
13 Correct 12 ms 1428 KB Output is correct
14 Correct 8 ms 1620 KB Output is correct
15 Correct 34 ms 3044 KB Output is correct
16 Correct 29 ms 3048 KB Output is correct
17 Correct 22 ms 3644 KB Output is correct
18 Correct 22 ms 3104 KB Output is correct
19 Correct 31 ms 3296 KB Output is correct
20 Correct 30 ms 3304 KB Output is correct
21 Correct 22 ms 3540 KB Output is correct
22 Correct 23 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 516 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1492 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1136 KB Output is correct
12 Correct 11 ms 1620 KB Output is correct
13 Correct 12 ms 1428 KB Output is correct
14 Correct 8 ms 1620 KB Output is correct
15 Correct 34 ms 3044 KB Output is correct
16 Correct 29 ms 3048 KB Output is correct
17 Correct 22 ms 3644 KB Output is correct
18 Correct 22 ms 3104 KB Output is correct
19 Correct 31 ms 3296 KB Output is correct
20 Correct 30 ms 3304 KB Output is correct
21 Correct 22 ms 3540 KB Output is correct
22 Correct 23 ms 3160 KB Output is correct
23 Correct 31 ms 3408 KB Output is correct
24 Correct 31 ms 3248 KB Output is correct
25 Correct 25 ms 3632 KB Output is correct
26 Correct 23 ms 3068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 516 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1492 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1136 KB Output is correct
12 Correct 11 ms 1620 KB Output is correct
13 Correct 12 ms 1428 KB Output is correct
14 Correct 8 ms 1620 KB Output is correct
15 Correct 34 ms 3044 KB Output is correct
16 Correct 29 ms 3048 KB Output is correct
17 Correct 22 ms 3644 KB Output is correct
18 Correct 22 ms 3104 KB Output is correct
19 Correct 31 ms 3296 KB Output is correct
20 Correct 30 ms 3304 KB Output is correct
21 Correct 22 ms 3540 KB Output is correct
22 Correct 23 ms 3160 KB Output is correct
23 Correct 31 ms 3408 KB Output is correct
24 Correct 31 ms 3248 KB Output is correct
25 Correct 25 ms 3632 KB Output is correct
26 Correct 23 ms 3068 KB Output is correct
27 Correct 31 ms 3312 KB Output is correct
28 Correct 32 ms 3404 KB Output is correct
29 Correct 25 ms 4040 KB Output is correct
30 Correct 23 ms 3484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 516 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1492 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1136 KB Output is correct
12 Correct 11 ms 1620 KB Output is correct
13 Correct 12 ms 1428 KB Output is correct
14 Correct 8 ms 1620 KB Output is correct
15 Correct 34 ms 3044 KB Output is correct
16 Correct 29 ms 3048 KB Output is correct
17 Correct 22 ms 3644 KB Output is correct
18 Correct 22 ms 3104 KB Output is correct
19 Correct 31 ms 3296 KB Output is correct
20 Correct 30 ms 3304 KB Output is correct
21 Correct 22 ms 3540 KB Output is correct
22 Correct 23 ms 3160 KB Output is correct
23 Correct 31 ms 3408 KB Output is correct
24 Correct 31 ms 3248 KB Output is correct
25 Correct 25 ms 3632 KB Output is correct
26 Correct 23 ms 3068 KB Output is correct
27 Correct 31 ms 3312 KB Output is correct
28 Correct 32 ms 3404 KB Output is correct
29 Correct 25 ms 4040 KB Output is correct
30 Correct 23 ms 3484 KB Output is correct
31 Correct 32 ms 3580 KB Output is correct
32 Correct 33 ms 3424 KB Output is correct
33 Correct 24 ms 3904 KB Output is correct
34 Correct 24 ms 3624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 516 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1492 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1136 KB Output is correct
12 Correct 11 ms 1620 KB Output is correct
13 Correct 12 ms 1428 KB Output is correct
14 Correct 8 ms 1620 KB Output is correct
15 Correct 34 ms 3044 KB Output is correct
16 Correct 29 ms 3048 KB Output is correct
17 Correct 22 ms 3644 KB Output is correct
18 Correct 22 ms 3104 KB Output is correct
19 Correct 31 ms 3296 KB Output is correct
20 Correct 30 ms 3304 KB Output is correct
21 Correct 22 ms 3540 KB Output is correct
22 Correct 23 ms 3160 KB Output is correct
23 Correct 31 ms 3408 KB Output is correct
24 Correct 31 ms 3248 KB Output is correct
25 Correct 25 ms 3632 KB Output is correct
26 Correct 23 ms 3068 KB Output is correct
27 Correct 31 ms 3312 KB Output is correct
28 Correct 32 ms 3404 KB Output is correct
29 Correct 25 ms 4040 KB Output is correct
30 Correct 23 ms 3484 KB Output is correct
31 Correct 32 ms 3580 KB Output is correct
32 Correct 33 ms 3424 KB Output is correct
33 Correct 24 ms 3904 KB Output is correct
34 Correct 24 ms 3624 KB Output is correct
35 Incorrect 33 ms 3416 KB Wrong Answer [2]
36 Halted 0 ms 0 KB -