답안 #967177

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
967177 2024-04-21T12:19:30 Z Soumya1 Minerals (JOI19_minerals) C++17
90 / 100
60 ms 4084 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;
  random_shuffle(a.begin(), a.end());
  random_shuffle(b.begin(), b.end());
  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:26:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |     if (la.size() == mid) ra.push_back(i);
      |         ~~~~~~~~~~^~~~~~
minerals.cpp:27:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |     else if (ra.size() == n - mid) la.push_back(i);
      |              ~~~~~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 4 ms 600 KB Output is correct
4 Correct 8 ms 856 KB Output is correct
5 Correct 15 ms 1488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 600 KB Output is correct
8 Correct 8 ms 856 KB Output is correct
9 Correct 15 ms 1488 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 16 ms 1324 KB Output is correct
13 Correct 19 ms 1528 KB Output is correct
14 Correct 19 ms 1532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 600 KB Output is correct
8 Correct 8 ms 856 KB Output is correct
9 Correct 15 ms 1488 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 16 ms 1324 KB Output is correct
13 Correct 19 ms 1528 KB Output is correct
14 Correct 19 ms 1532 KB Output is correct
15 Correct 45 ms 3288 KB Output is correct
16 Correct 54 ms 3284 KB Output is correct
17 Correct 46 ms 3360 KB Output is correct
18 Correct 53 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 600 KB Output is correct
8 Correct 8 ms 856 KB Output is correct
9 Correct 15 ms 1488 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 16 ms 1324 KB Output is correct
13 Correct 19 ms 1528 KB Output is correct
14 Correct 19 ms 1532 KB Output is correct
15 Correct 45 ms 3288 KB Output is correct
16 Correct 54 ms 3284 KB Output is correct
17 Correct 46 ms 3360 KB Output is correct
18 Correct 53 ms 3160 KB Output is correct
19 Correct 47 ms 3304 KB Output is correct
20 Correct 55 ms 3388 KB Output is correct
21 Correct 44 ms 3736 KB Output is correct
22 Correct 44 ms 3416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 600 KB Output is correct
8 Correct 8 ms 856 KB Output is correct
9 Correct 15 ms 1488 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 16 ms 1324 KB Output is correct
13 Correct 19 ms 1528 KB Output is correct
14 Correct 19 ms 1532 KB Output is correct
15 Correct 45 ms 3288 KB Output is correct
16 Correct 54 ms 3284 KB Output is correct
17 Correct 46 ms 3360 KB Output is correct
18 Correct 53 ms 3160 KB Output is correct
19 Correct 47 ms 3304 KB Output is correct
20 Correct 55 ms 3388 KB Output is correct
21 Correct 44 ms 3736 KB Output is correct
22 Correct 44 ms 3416 KB Output is correct
23 Correct 51 ms 3464 KB Output is correct
24 Correct 48 ms 3520 KB Output is correct
25 Correct 48 ms 3232 KB Output is correct
26 Correct 46 ms 3232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 600 KB Output is correct
8 Correct 8 ms 856 KB Output is correct
9 Correct 15 ms 1488 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 16 ms 1324 KB Output is correct
13 Correct 19 ms 1528 KB Output is correct
14 Correct 19 ms 1532 KB Output is correct
15 Correct 45 ms 3288 KB Output is correct
16 Correct 54 ms 3284 KB Output is correct
17 Correct 46 ms 3360 KB Output is correct
18 Correct 53 ms 3160 KB Output is correct
19 Correct 47 ms 3304 KB Output is correct
20 Correct 55 ms 3388 KB Output is correct
21 Correct 44 ms 3736 KB Output is correct
22 Correct 44 ms 3416 KB Output is correct
23 Correct 51 ms 3464 KB Output is correct
24 Correct 48 ms 3520 KB Output is correct
25 Correct 48 ms 3232 KB Output is correct
26 Correct 46 ms 3232 KB Output is correct
27 Correct 54 ms 3460 KB Output is correct
28 Correct 52 ms 3468 KB Output is correct
29 Correct 48 ms 3500 KB Output is correct
30 Correct 47 ms 4084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 600 KB Output is correct
8 Correct 8 ms 856 KB Output is correct
9 Correct 15 ms 1488 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 16 ms 1324 KB Output is correct
13 Correct 19 ms 1528 KB Output is correct
14 Correct 19 ms 1532 KB Output is correct
15 Correct 45 ms 3288 KB Output is correct
16 Correct 54 ms 3284 KB Output is correct
17 Correct 46 ms 3360 KB Output is correct
18 Correct 53 ms 3160 KB Output is correct
19 Correct 47 ms 3304 KB Output is correct
20 Correct 55 ms 3388 KB Output is correct
21 Correct 44 ms 3736 KB Output is correct
22 Correct 44 ms 3416 KB Output is correct
23 Correct 51 ms 3464 KB Output is correct
24 Correct 48 ms 3520 KB Output is correct
25 Correct 48 ms 3232 KB Output is correct
26 Correct 46 ms 3232 KB Output is correct
27 Correct 54 ms 3460 KB Output is correct
28 Correct 52 ms 3468 KB Output is correct
29 Correct 48 ms 3500 KB Output is correct
30 Correct 47 ms 4084 KB Output is correct
31 Correct 58 ms 3580 KB Output is correct
32 Correct 60 ms 3636 KB Output is correct
33 Correct 48 ms 3656 KB Output is correct
34 Correct 47 ms 3384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 600 KB Output is correct
8 Correct 8 ms 856 KB Output is correct
9 Correct 15 ms 1488 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 11 ms 1112 KB Output is correct
12 Correct 16 ms 1324 KB Output is correct
13 Correct 19 ms 1528 KB Output is correct
14 Correct 19 ms 1532 KB Output is correct
15 Correct 45 ms 3288 KB Output is correct
16 Correct 54 ms 3284 KB Output is correct
17 Correct 46 ms 3360 KB Output is correct
18 Correct 53 ms 3160 KB Output is correct
19 Correct 47 ms 3304 KB Output is correct
20 Correct 55 ms 3388 KB Output is correct
21 Correct 44 ms 3736 KB Output is correct
22 Correct 44 ms 3416 KB Output is correct
23 Correct 51 ms 3464 KB Output is correct
24 Correct 48 ms 3520 KB Output is correct
25 Correct 48 ms 3232 KB Output is correct
26 Correct 46 ms 3232 KB Output is correct
27 Correct 54 ms 3460 KB Output is correct
28 Correct 52 ms 3468 KB Output is correct
29 Correct 48 ms 3500 KB Output is correct
30 Correct 47 ms 4084 KB Output is correct
31 Correct 58 ms 3580 KB Output is correct
32 Correct 60 ms 3636 KB Output is correct
33 Correct 48 ms 3656 KB Output is correct
34 Correct 47 ms 3384 KB Output is correct
35 Incorrect 52 ms 3592 KB Wrong Answer [2]
36 Halted 0 ms 0 KB -