답안 #376811

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
376811 2021-03-12T04:40:26 Z 2qbingxuan Minerals (JOI19_minerals) C++17
25 / 100
16 ms 1132 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

void dq(int l, int r, vector<int> cand) {
    // cerr << l << ' ' << r << ' ' << " cand = ";
    // for (int x: cand) cerr << x << ' ';
    // cerr << endl;
    assert(r - l + 1 == cand.size());
    if (l == r) {
        // cerr << "cand.size() = " << cand.size() << endl;
        if (l < cand[0])
            Answer(cand[0], l);
        return;
    }
    int m = l+(r-l)/2;
    int cur = -1;
    for (int i = l; i <= m; i++)
        cur = Query(i);
    vector<int> L, R;
    for (int x: cand) {
        if (Query(x) == cur) {
            L.push_back(x);
        } else {
            R.push_back(x);
        }
        Query(x);
    }
    for (int i = l; i <= m; i++)
        Query(i);
    dq(l, m, L);
    dq(m+1, r, R);
}
int f(int n) {
    int dep = __lg(n) + 1;
    return n * 6 * dep;
}
void Solve(int N) {
    vector<int> jizz(N);
    iota(jizz.begin(), jizz.end(), N+1);
    dq(1, N, jizz);
    // for (int i = 1; i <= 50; i++) cerr << i << ' ' << f(i) << endl;
    /*
    for (int i = 1; i <= N*2; i++) {
        Query(i);
        for (int j = 1; j < i; j++) {
            if (Query(j) == 1)
                Answer(i, j);
            Query(j);
        }
        Query(i);
    }
    */
}

Compilation message

In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from minerals.cpp:2:
minerals.cpp: In function 'void dq(int, int, std::vector<int>)':
minerals.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     assert(r - l + 1 == cand.size());
      |            ~~~~~~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 4 ms 492 KB Output is correct
4 Correct 9 ms 748 KB Output is correct
5 Correct 16 ms 1132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -