Submission #836164

# Submission time Handle Problem Language Result Execution time Memory
836164 2023-08-24T08:14:10 Z unnick Minerals (JOI19_minerals) C++14
70 / 100
19 ms 2000 KB
#include "minerals.h"

#include <iostream>
#include <vector>

using namespace std;

void Solve(int N) {
  vector<int> fst;
  vector<int> snd;
  int prev = 0;
  for (int i = 1; i <= N*2; i++) {
    int tmp = Query(i);
    if (tmp > prev) fst.push_back(i);
    prev = tmp;
  }
  for (int i = 1, j = 0; i <= N*2; i++) {
    if (j<N && i == fst[j]) {
      j++;
      continue;
    }
    snd.push_back(i);
  }

  int baseline;
  for (int i = 0; i < N; i++) {
    if (i&1) baseline = Query(fst[i]);
  }
  vector<int> ids(N, 0);
  for (int pd = 1; pd < N; pd <<= 1) {
    if (pd > 1) {
      for (int i = 0; i < N; i++) {
        if ((i&pd) ^ ((i<<1)&pd)) baseline = Query(fst[i]);
      }
    }
    for (int i = 0; i < N; i++) {
      int tmp = Query(snd[i]);
      int bit = (tmp != baseline);
      baseline = tmp;
      ids[i] += bit * pd;
    }
  }
  for (int i = 0; i < N; i++) {
    Answer(fst[ids[i]], snd[i]);
  }
}
# Verdict Execution time Memory 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 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 5 ms 848 KB Output is correct
# Verdict Execution time Memory 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 0 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 1 ms 464 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 5 ms 720 KB Output is correct
12 Correct 6 ms 848 KB Output is correct
13 Correct 4 ms 848 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
# Verdict Execution time Memory 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 0 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 1 ms 464 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 5 ms 720 KB Output is correct
12 Correct 6 ms 848 KB Output is correct
13 Correct 4 ms 848 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
15 Correct 19 ms 2000 KB Output is correct
16 Correct 15 ms 2000 KB Output is correct
17 Correct 10 ms 2000 KB Output is correct
18 Correct 10 ms 1964 KB Output is correct
# Verdict Execution time Memory 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 0 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 1 ms 464 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 5 ms 720 KB Output is correct
12 Correct 6 ms 848 KB Output is correct
13 Correct 4 ms 848 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
15 Correct 19 ms 2000 KB Output is correct
16 Correct 15 ms 2000 KB Output is correct
17 Correct 10 ms 2000 KB Output is correct
18 Correct 10 ms 1964 KB Output is correct
19 Incorrect 15 ms 1744 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 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 1 ms 464 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 5 ms 720 KB Output is correct
12 Correct 6 ms 848 KB Output is correct
13 Correct 4 ms 848 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
15 Correct 19 ms 2000 KB Output is correct
16 Correct 15 ms 2000 KB Output is correct
17 Correct 10 ms 2000 KB Output is correct
18 Correct 10 ms 1964 KB Output is correct
19 Incorrect 15 ms 1744 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 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 1 ms 464 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 5 ms 720 KB Output is correct
12 Correct 6 ms 848 KB Output is correct
13 Correct 4 ms 848 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
15 Correct 19 ms 2000 KB Output is correct
16 Correct 15 ms 2000 KB Output is correct
17 Correct 10 ms 2000 KB Output is correct
18 Correct 10 ms 1964 KB Output is correct
19 Incorrect 15 ms 1744 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 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 1 ms 464 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 5 ms 720 KB Output is correct
12 Correct 6 ms 848 KB Output is correct
13 Correct 4 ms 848 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
15 Correct 19 ms 2000 KB Output is correct
16 Correct 15 ms 2000 KB Output is correct
17 Correct 10 ms 2000 KB Output is correct
18 Correct 10 ms 1964 KB Output is correct
19 Incorrect 15 ms 1744 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 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 1 ms 464 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 5 ms 720 KB Output is correct
12 Correct 6 ms 848 KB Output is correct
13 Correct 4 ms 848 KB Output is correct
14 Correct 4 ms 848 KB Output is correct
15 Correct 19 ms 2000 KB Output is correct
16 Correct 15 ms 2000 KB Output is correct
17 Correct 10 ms 2000 KB Output is correct
18 Correct 10 ms 1964 KB Output is correct
19 Incorrect 15 ms 1744 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -