Submission #967175

# Submission time Handle Problem Language Result Execution time Memory
967175 2024-04-21T12:18:40 Z Soumya1 Minerals (JOI19_minerals) C++17
80 / 100
30 ms 3892 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);
    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);
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 6 ms 1112 KB Output is correct
5 Correct 10 ms 1368 KB Output is correct
# Verdict Execution time Memory 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 596 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 9 ms 1368 KB Output is correct
14 Correct 9 ms 1520 KB Output is correct
# Verdict Execution time Memory 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 596 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 9 ms 1368 KB Output is correct
14 Correct 9 ms 1520 KB Output is correct
15 Correct 28 ms 3152 KB Output is correct
16 Correct 28 ms 3408 KB Output is correct
17 Correct 22 ms 3184 KB Output is correct
18 Correct 23 ms 3288 KB Output is correct
# Verdict Execution time Memory 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 596 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 9 ms 1368 KB Output is correct
14 Correct 9 ms 1520 KB Output is correct
15 Correct 28 ms 3152 KB Output is correct
16 Correct 28 ms 3408 KB Output is correct
17 Correct 22 ms 3184 KB Output is correct
18 Correct 23 ms 3288 KB Output is correct
19 Correct 29 ms 3108 KB Output is correct
20 Correct 29 ms 3300 KB Output is correct
21 Correct 23 ms 3276 KB Output is correct
22 Correct 24 ms 3240 KB Output is correct
# Verdict Execution time Memory 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 596 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 9 ms 1368 KB Output is correct
14 Correct 9 ms 1520 KB Output is correct
15 Correct 28 ms 3152 KB Output is correct
16 Correct 28 ms 3408 KB Output is correct
17 Correct 22 ms 3184 KB Output is correct
18 Correct 23 ms 3288 KB Output is correct
19 Correct 29 ms 3108 KB Output is correct
20 Correct 29 ms 3300 KB Output is correct
21 Correct 23 ms 3276 KB Output is correct
22 Correct 24 ms 3240 KB Output is correct
23 Correct 30 ms 3412 KB Output is correct
24 Correct 29 ms 3408 KB Output is correct
25 Correct 24 ms 3540 KB Output is correct
26 Correct 27 ms 3892 KB Output is correct
# Verdict Execution time Memory 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 596 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 9 ms 1368 KB Output is correct
14 Correct 9 ms 1520 KB Output is correct
15 Correct 28 ms 3152 KB Output is correct
16 Correct 28 ms 3408 KB Output is correct
17 Correct 22 ms 3184 KB Output is correct
18 Correct 23 ms 3288 KB Output is correct
19 Correct 29 ms 3108 KB Output is correct
20 Correct 29 ms 3300 KB Output is correct
21 Correct 23 ms 3276 KB Output is correct
22 Correct 24 ms 3240 KB Output is correct
23 Correct 30 ms 3412 KB Output is correct
24 Correct 29 ms 3408 KB Output is correct
25 Correct 24 ms 3540 KB Output is correct
26 Correct 27 ms 3892 KB Output is correct
27 Incorrect 30 ms 3320 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 596 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 9 ms 1368 KB Output is correct
14 Correct 9 ms 1520 KB Output is correct
15 Correct 28 ms 3152 KB Output is correct
16 Correct 28 ms 3408 KB Output is correct
17 Correct 22 ms 3184 KB Output is correct
18 Correct 23 ms 3288 KB Output is correct
19 Correct 29 ms 3108 KB Output is correct
20 Correct 29 ms 3300 KB Output is correct
21 Correct 23 ms 3276 KB Output is correct
22 Correct 24 ms 3240 KB Output is correct
23 Correct 30 ms 3412 KB Output is correct
24 Correct 29 ms 3408 KB Output is correct
25 Correct 24 ms 3540 KB Output is correct
26 Correct 27 ms 3892 KB Output is correct
27 Incorrect 30 ms 3320 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 596 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 9 ms 1368 KB Output is correct
14 Correct 9 ms 1520 KB Output is correct
15 Correct 28 ms 3152 KB Output is correct
16 Correct 28 ms 3408 KB Output is correct
17 Correct 22 ms 3184 KB Output is correct
18 Correct 23 ms 3288 KB Output is correct
19 Correct 29 ms 3108 KB Output is correct
20 Correct 29 ms 3300 KB Output is correct
21 Correct 23 ms 3276 KB Output is correct
22 Correct 24 ms 3240 KB Output is correct
23 Correct 30 ms 3412 KB Output is correct
24 Correct 29 ms 3408 KB Output is correct
25 Correct 24 ms 3540 KB Output is correct
26 Correct 27 ms 3892 KB Output is correct
27 Incorrect 30 ms 3320 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -