Submission #624643

# Submission time Handle Problem Language Result Execution time Memory
624643 2022-08-08T15:00:29 Z Do_you_copy Minerals (JOI19_minerals) C++17
40 / 100
25 ms 2132 KB
#include <bits/stdc++.h>
#include "minerals.h"
#define taskname "test"
#define fi first
#define se second
#define pb push_back
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
using ll = long long;
using ull = unsigned ll;
using ld = long double;
using pii = pair <int, int>;
using pil = pair <int, ll>;
using pli = pair <ll, int>;
using pll = pair <ll, ll>;
mt19937 Rand(chrono::steady_clock::now().time_since_epoch().count());

ll min(const ll &a, const ll &b){
    return (a < b) ? a : b;
}

ll max(const ll &a, const ll &b){
    return (a > b) ? a : b;
}

//const ll Mod = 1000000007;
//const ll Mod2 = 999999999989;
//only use when required
const int maxN = 1e5 + 1;

int n;

vector <int> a, b;
int cur = 0;

void parallel_bs(vector <int> &w, int l = 1, int r = n){
    if (l == r){
        Answer(w.back(), a[l]);
        w.clear();
        return;
    }
    int mid = (l + r) / 2;
    int last = 0;
    while (cur < mid){
        last = Query(a[++cur]);
    }
    while (cur > mid){
        last = Query(a[cur--]);
    }
    vector <int> left, right;
    for (int i: w){
        int tem = Query(i);
        if (last == tem) left.pb(i);
        else right.pb(i);
        Query(i);
    }
    w.clear();
    parallel_bs(left, l, mid);
    parallel_bs(right, mid + 1, r);
}

void Solve(int N){
    n = N;
    int last = 0;
    a.pb(0);
    for (int i = 1; i <= 2 * n; ++i){
        int tem = Query(i);
        if (tem > last) a.pb(i);
        else b.pb(i);
        last = tem;
    }
    for (int i = 1; i <= 2 * n; ++i) Query(i);
    parallel_bs(b, 1, n);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 8 ms 592 KB Output is correct
5 Correct 12 ms 864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 12 ms 864 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 780 KB Output is correct
12 Correct 11 ms 976 KB Output is correct
13 Correct 9 ms 992 KB Output is correct
14 Correct 13 ms 908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 12 ms 864 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 780 KB Output is correct
12 Correct 11 ms 976 KB Output is correct
13 Correct 9 ms 992 KB Output is correct
14 Correct 13 ms 908 KB Output is correct
15 Incorrect 25 ms 2132 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 12 ms 864 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 780 KB Output is correct
12 Correct 11 ms 976 KB Output is correct
13 Correct 9 ms 992 KB Output is correct
14 Correct 13 ms 908 KB Output is correct
15 Incorrect 25 ms 2132 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 12 ms 864 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 780 KB Output is correct
12 Correct 11 ms 976 KB Output is correct
13 Correct 9 ms 992 KB Output is correct
14 Correct 13 ms 908 KB Output is correct
15 Incorrect 25 ms 2132 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 12 ms 864 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 780 KB Output is correct
12 Correct 11 ms 976 KB Output is correct
13 Correct 9 ms 992 KB Output is correct
14 Correct 13 ms 908 KB Output is correct
15 Incorrect 25 ms 2132 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 12 ms 864 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 780 KB Output is correct
12 Correct 11 ms 976 KB Output is correct
13 Correct 9 ms 992 KB Output is correct
14 Correct 13 ms 908 KB Output is correct
15 Incorrect 25 ms 2132 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 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 2 ms 336 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 12 ms 864 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 780 KB Output is correct
12 Correct 11 ms 976 KB Output is correct
13 Correct 9 ms 992 KB Output is correct
14 Correct 13 ms 908 KB Output is correct
15 Incorrect 25 ms 2132 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -