Submission #771993

# Submission time Handle Problem Language Result Execution time Memory
771993 2023-07-03T13:27:58 Z Valters07 Minerals (JOI19_minerals) C++14
80 / 100
26 ms 2796 KB
#include <bits/stdc++.h>
#include "minerals.h"
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define en cin.close();return 0;
#define pb push_back
#define fi first//printf("%lli\n",cur);
#define se second//scanf("%lli",&n);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n1, cur;
int q(int x)
{
    return cur=Query(x);
}
void go(vector<int> &a, vector<int> &b, bool isa, bool isb)
{
    assert(a.size()==b.size());
    int n = a.size(), mid = n/2;
    if(n==1)
        Answer(a[0],b[0]);
    else if(isb)
    {
        vector<int> la, ra, lb, rb;
        for(int i = 0;i<n;i++)
        {
            if(i<mid)
            {
                if(!isa)
                    q(a[i]);
                la.pb(a[i]);
            }
            else
            {
                if(isa)
                    q(a[i]);
                ra.pb(a[i]);
            }
        }
        for(int i = 0, lst=cur;i<n;i++)
        {
            int t = q(b[i]);
            if(t==lst)
                lb.pb(b[i]);
            else
                rb.pb(b[i]);
            lst=t;
        }
        go(la,lb,1,0);
        go(ra,rb,0,0);
    }
    else
    {
        vector<int> la, ra, lb, rb;
        for(int i = 0;i<n;i++)
        {
            if(i<mid)
            {
                if(!isa)
                    q(a[i]);
                la.pb(a[i]);
            }
            else
            {
                if(isa)
                    q(a[i]);
                ra.pb(a[i]);
            }
        }
        for(int i = 0, lst=cur;i<n;i++)
        {
            int t = q(b[i]);
            if(t==lst)
                lb.pb(b[i]);
            else
                rb.pb(b[i]);
            lst=t;
        }
        go(la,lb,1,1);
        go(ra,rb,0,1);
    }
}
void Solve(int n)
{
    n1=cur=n;
    vector<int> a, b;
    for(int i = 1, lst = 0;i<=2*n;i++)
    {
        int t = q(i);
        if(t==lst)
            b.pb(i);
        else
            a.pb(i);
        lst=t;
    }
    go(a,b,1,1);
}
# 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 3 ms 464 KB Output is correct
4 Correct 5 ms 720 KB Output is correct
5 Correct 9 ms 1104 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 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 848 KB Output is correct
12 Correct 10 ms 1104 KB Output is correct
13 Correct 7 ms 1048 KB Output is correct
14 Correct 7 ms 1104 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 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 848 KB Output is correct
12 Correct 10 ms 1104 KB Output is correct
13 Correct 7 ms 1048 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 25 ms 2656 KB Output is correct
16 Correct 24 ms 2608 KB Output is correct
17 Correct 21 ms 2432 KB Output is correct
18 Correct 22 ms 2324 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 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 848 KB Output is correct
12 Correct 10 ms 1104 KB Output is correct
13 Correct 7 ms 1048 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 25 ms 2656 KB Output is correct
16 Correct 24 ms 2608 KB Output is correct
17 Correct 21 ms 2432 KB Output is correct
18 Correct 22 ms 2324 KB Output is correct
19 Correct 24 ms 2640 KB Output is correct
20 Correct 24 ms 2660 KB Output is correct
21 Correct 19 ms 2484 KB Output is correct
22 Correct 19 ms 2320 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 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 848 KB Output is correct
12 Correct 10 ms 1104 KB Output is correct
13 Correct 7 ms 1048 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 25 ms 2656 KB Output is correct
16 Correct 24 ms 2608 KB Output is correct
17 Correct 21 ms 2432 KB Output is correct
18 Correct 22 ms 2324 KB Output is correct
19 Correct 24 ms 2640 KB Output is correct
20 Correct 24 ms 2660 KB Output is correct
21 Correct 19 ms 2484 KB Output is correct
22 Correct 19 ms 2320 KB Output is correct
23 Correct 24 ms 2668 KB Output is correct
24 Correct 26 ms 2668 KB Output is correct
25 Correct 20 ms 2512 KB Output is correct
26 Correct 24 ms 2464 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 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 848 KB Output is correct
12 Correct 10 ms 1104 KB Output is correct
13 Correct 7 ms 1048 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 25 ms 2656 KB Output is correct
16 Correct 24 ms 2608 KB Output is correct
17 Correct 21 ms 2432 KB Output is correct
18 Correct 22 ms 2324 KB Output is correct
19 Correct 24 ms 2640 KB Output is correct
20 Correct 24 ms 2660 KB Output is correct
21 Correct 19 ms 2484 KB Output is correct
22 Correct 19 ms 2320 KB Output is correct
23 Correct 24 ms 2668 KB Output is correct
24 Correct 26 ms 2668 KB Output is correct
25 Correct 20 ms 2512 KB Output is correct
26 Correct 24 ms 2464 KB Output is correct
27 Incorrect 25 ms 2796 KB Wrong Answer [2]
28 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 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 848 KB Output is correct
12 Correct 10 ms 1104 KB Output is correct
13 Correct 7 ms 1048 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 25 ms 2656 KB Output is correct
16 Correct 24 ms 2608 KB Output is correct
17 Correct 21 ms 2432 KB Output is correct
18 Correct 22 ms 2324 KB Output is correct
19 Correct 24 ms 2640 KB Output is correct
20 Correct 24 ms 2660 KB Output is correct
21 Correct 19 ms 2484 KB Output is correct
22 Correct 19 ms 2320 KB Output is correct
23 Correct 24 ms 2668 KB Output is correct
24 Correct 26 ms 2668 KB Output is correct
25 Correct 20 ms 2512 KB Output is correct
26 Correct 24 ms 2464 KB Output is correct
27 Incorrect 25 ms 2796 KB Wrong Answer [2]
28 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 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 848 KB Output is correct
12 Correct 10 ms 1104 KB Output is correct
13 Correct 7 ms 1048 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 25 ms 2656 KB Output is correct
16 Correct 24 ms 2608 KB Output is correct
17 Correct 21 ms 2432 KB Output is correct
18 Correct 22 ms 2324 KB Output is correct
19 Correct 24 ms 2640 KB Output is correct
20 Correct 24 ms 2660 KB Output is correct
21 Correct 19 ms 2484 KB Output is correct
22 Correct 19 ms 2320 KB Output is correct
23 Correct 24 ms 2668 KB Output is correct
24 Correct 26 ms 2668 KB Output is correct
25 Correct 20 ms 2512 KB Output is correct
26 Correct 24 ms 2464 KB Output is correct
27 Incorrect 25 ms 2796 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -