Submission #624689

# Submission time Handle Problem Language Result Execution time Memory
624689 2022-08-08T15:38:17 Z Do_you_copy Minerals (JOI19_minerals) C++17
40 / 100
33 ms 2120 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);
        last = tem;
    }
    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 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 356 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 3 ms 464 KB Output is correct
4 Correct 5 ms 592 KB Output is correct
5 Correct 9 ms 936 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 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 9 ms 936 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 832 KB Output is correct
12 Correct 12 ms 936 KB Output is correct
13 Correct 10 ms 976 KB Output is correct
14 Correct 9 ms 976 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 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 9 ms 936 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 832 KB Output is correct
12 Correct 12 ms 936 KB Output is correct
13 Correct 10 ms 976 KB Output is correct
14 Correct 9 ms 976 KB Output is correct
15 Incorrect 33 ms 2120 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 9 ms 936 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 832 KB Output is correct
12 Correct 12 ms 936 KB Output is correct
13 Correct 10 ms 976 KB Output is correct
14 Correct 9 ms 976 KB Output is correct
15 Incorrect 33 ms 2120 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 9 ms 936 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 832 KB Output is correct
12 Correct 12 ms 936 KB Output is correct
13 Correct 10 ms 976 KB Output is correct
14 Correct 9 ms 976 KB Output is correct
15 Incorrect 33 ms 2120 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 9 ms 936 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 832 KB Output is correct
12 Correct 12 ms 936 KB Output is correct
13 Correct 10 ms 976 KB Output is correct
14 Correct 9 ms 976 KB Output is correct
15 Incorrect 33 ms 2120 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 9 ms 936 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 832 KB Output is correct
12 Correct 12 ms 936 KB Output is correct
13 Correct 10 ms 976 KB Output is correct
14 Correct 9 ms 976 KB Output is correct
15 Incorrect 33 ms 2120 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 592 KB Output is correct
9 Correct 9 ms 936 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 832 KB Output is correct
12 Correct 12 ms 936 KB Output is correct
13 Correct 10 ms 976 KB Output is correct
14 Correct 9 ms 976 KB Output is correct
15 Incorrect 33 ms 2120 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -