답안 #997392

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
997392 2024-06-12T08:36:00 Z 12345678 Minerals (JOI19_minerals) C++17
85 / 100
27 ms 3076 KB
#include "minerals.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=5e4+5;

mt19937 rng(time(0));

int p, c;
vector<int> l, r;


int update(int x)
{
    p=Query(x);
    swap(c, p);
    return c!=p;
}

void solve(vector<int> &l, vector<int> &r, int t)
{
    int sz=l.size();
    if (sz==1) return Answer(l[0], r[0]), void();
    int md=(int)(0.4*(sz-1));
    vector<int> l1, l2, r1, r2;
    for (int i=0; i<=md; i++) l1.push_back(l[i]), update(l[i]);
    for (int i=md+1; i<sz; i++) r1.push_back(l[i]);
    for (int i=0; i<sz; i++)
    {
        if (l2.size()==sz) r2.push_back(r[i]);
        else if (r2.size()==sz) l2.push_back(r[i]);
        else if (update(r[i])==t) l2.push_back(r[i]);
        else r2.push_back(r[i]); 
    }
    solve(l1, l2, !t); solve(r1, r2, t);
}

void Solve(int N) {
    for (int i=1; i<=2*N; i++) 
    {
        if (update(i)) l.push_back(i);
        else r.push_back(i);
    }
    solve(l, r, 1);
}

Compilation message

minerals.cpp: In function 'void solve(std::vector<int>&, std::vector<int>&, int)':
minerals.cpp:31:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |         if (l2.size()==sz) r2.push_back(r[i]);
      |             ~~~~~~~~~^~~~
minerals.cpp:32:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |         else if (r2.size()==sz) l2.push_back(r[i]);
      |                  ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 4 ms 856 KB Output is correct
5 Correct 10 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 4 ms 856 KB Output is correct
9 Correct 10 ms 1236 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 8 ms 1280 KB Output is correct
14 Correct 10 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 4 ms 856 KB Output is correct
9 Correct 10 ms 1236 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 8 ms 1280 KB Output is correct
14 Correct 10 ms 1368 KB Output is correct
15 Correct 23 ms 2904 KB Output is correct
16 Correct 23 ms 2780 KB Output is correct
17 Correct 18 ms 2772 KB Output is correct
18 Correct 18 ms 2576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 4 ms 856 KB Output is correct
9 Correct 10 ms 1236 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 8 ms 1280 KB Output is correct
14 Correct 10 ms 1368 KB Output is correct
15 Correct 23 ms 2904 KB Output is correct
16 Correct 23 ms 2780 KB Output is correct
17 Correct 18 ms 2772 KB Output is correct
18 Correct 18 ms 2576 KB Output is correct
19 Correct 24 ms 2896 KB Output is correct
20 Correct 23 ms 2900 KB Output is correct
21 Correct 21 ms 2772 KB Output is correct
22 Correct 22 ms 2988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 4 ms 856 KB Output is correct
9 Correct 10 ms 1236 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 8 ms 1280 KB Output is correct
14 Correct 10 ms 1368 KB Output is correct
15 Correct 23 ms 2904 KB Output is correct
16 Correct 23 ms 2780 KB Output is correct
17 Correct 18 ms 2772 KB Output is correct
18 Correct 18 ms 2576 KB Output is correct
19 Correct 24 ms 2896 KB Output is correct
20 Correct 23 ms 2900 KB Output is correct
21 Correct 21 ms 2772 KB Output is correct
22 Correct 22 ms 2988 KB Output is correct
23 Correct 24 ms 2904 KB Output is correct
24 Correct 24 ms 2836 KB Output is correct
25 Correct 18 ms 2820 KB Output is correct
26 Correct 19 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 4 ms 856 KB Output is correct
9 Correct 10 ms 1236 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 8 ms 1280 KB Output is correct
14 Correct 10 ms 1368 KB Output is correct
15 Correct 23 ms 2904 KB Output is correct
16 Correct 23 ms 2780 KB Output is correct
17 Correct 18 ms 2772 KB Output is correct
18 Correct 18 ms 2576 KB Output is correct
19 Correct 24 ms 2896 KB Output is correct
20 Correct 23 ms 2900 KB Output is correct
21 Correct 21 ms 2772 KB Output is correct
22 Correct 22 ms 2988 KB Output is correct
23 Correct 24 ms 2904 KB Output is correct
24 Correct 24 ms 2836 KB Output is correct
25 Correct 18 ms 2820 KB Output is correct
26 Correct 19 ms 2648 KB Output is correct
27 Correct 24 ms 2904 KB Output is correct
28 Correct 27 ms 2896 KB Output is correct
29 Correct 23 ms 2836 KB Output is correct
30 Correct 19 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 4 ms 856 KB Output is correct
9 Correct 10 ms 1236 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 8 ms 1280 KB Output is correct
14 Correct 10 ms 1368 KB Output is correct
15 Correct 23 ms 2904 KB Output is correct
16 Correct 23 ms 2780 KB Output is correct
17 Correct 18 ms 2772 KB Output is correct
18 Correct 18 ms 2576 KB Output is correct
19 Correct 24 ms 2896 KB Output is correct
20 Correct 23 ms 2900 KB Output is correct
21 Correct 21 ms 2772 KB Output is correct
22 Correct 22 ms 2988 KB Output is correct
23 Correct 24 ms 2904 KB Output is correct
24 Correct 24 ms 2836 KB Output is correct
25 Correct 18 ms 2820 KB Output is correct
26 Correct 19 ms 2648 KB Output is correct
27 Correct 24 ms 2904 KB Output is correct
28 Correct 27 ms 2896 KB Output is correct
29 Correct 23 ms 2836 KB Output is correct
30 Correct 19 ms 2648 KB Output is correct
31 Incorrect 26 ms 3076 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 4 ms 856 KB Output is correct
9 Correct 10 ms 1236 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 8 ms 1280 KB Output is correct
14 Correct 10 ms 1368 KB Output is correct
15 Correct 23 ms 2904 KB Output is correct
16 Correct 23 ms 2780 KB Output is correct
17 Correct 18 ms 2772 KB Output is correct
18 Correct 18 ms 2576 KB Output is correct
19 Correct 24 ms 2896 KB Output is correct
20 Correct 23 ms 2900 KB Output is correct
21 Correct 21 ms 2772 KB Output is correct
22 Correct 22 ms 2988 KB Output is correct
23 Correct 24 ms 2904 KB Output is correct
24 Correct 24 ms 2836 KB Output is correct
25 Correct 18 ms 2820 KB Output is correct
26 Correct 19 ms 2648 KB Output is correct
27 Correct 24 ms 2904 KB Output is correct
28 Correct 27 ms 2896 KB Output is correct
29 Correct 23 ms 2836 KB Output is correct
30 Correct 19 ms 2648 KB Output is correct
31 Incorrect 26 ms 3076 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -