Submission #709599

# Submission time Handle Problem Language Result Execution time Memory
709599 2023-03-14T01:50:57 Z null_awe Minerals (JOI19_minerals) C++14
0 / 100
1 ms 720 KB
#include <iostream>
#include <vector>
#include <set>
#include "minerals.h"
using namespace std;

set<int> on;

void solve(vector<int> a, vector<int> b) {
  if (a.size() == 1) {
    Answer(a[0], b[0]);
    return;
  }
  int n = a.size() / 2, m = a.size() - n;
  vector<int> a1(n), a2(m);
  vector<int> b1, b2;
  for (int i = 0; i < n; ++i) a1[i] = a[i];
  for (int i = 0; i < m; ++i) {
    a2[i] = a[i + n];
    if (on.count(a2[i])) {
      on.erase(a2[i]);
      Query(a2[i]);
    }
  }
  for (int i = 0; i < n + m; ++i) {
    int now = Query(b[i]);
    if (now == on.size()) b1.push_back(b[i]);
    else b2.push_back(b[i]);
    Query(b[i]);
  }
  // for (int i = 0; i < n; ++i) Query(a[i]);
  solve(a1, b1), solve(a2, b2);
}

void Solve(int n) {
  vector<int> a, b;
  int last = 0;
  for (int i = 1; i <= 2 * n; ++i) {
    int now = Query(i);
    on.insert(i);
    if (now > last) a.push_back(i);
    else b.push_back(i);
    last = now;
  }
  for (int i : b) Query(i);
  solve(a, b);
}

Compilation message

minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>)':
minerals.cpp:27:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     if (now == on.size()) b1.push_back(b[i]);
      |         ~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 720 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -