Submission #377616

# Submission time Handle Problem Language Result Execution time Memory
377616 2021-03-14T11:45:41 Z jass921026 Minerals (JOI19_minerals) C++14
80 / 100
51 ms 2796 KB
#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> vl, vr;
void find_out(vector<int> &x, vector<int> &y, bool x_in, bool y_in){
    if(x.size()==1){
        Answer(x[0],y[0]);
        return;
    }
    vector<int> x1, x2, y1, y2;
    int v=0;
    for(int i=0;i<x.size();i++){
        if(i<x.size()/2) x1.push_back(x[i]);
        else x2.push_back(x[i]);
    }
    if(x_in){
        for(int i=x.size()/2;i<x.size();i++){
            v=Query(x[i]);
        }
    } else{
        for(int i=0;i<x.size()/2;i++){
            v=Query(x[i]);
        }
    }
    if(y_in){
        for(int i=0;i<y.size();i++){
            int tmp=Query(y[i]);
            if(tmp==v){
                y1.push_back(y[i]);
            } else{
                y2.push_back(y[i]);
                v--;
            }
        }
    } else{
        for(int i=0;i<y.size();i++){
            int tmp=Query(y[i]);
            if(tmp==v){
                y1.push_back(y[i]);
            } else{
                y2.push_back(y[i]);
                v++;
            }
        }
    }
    find_out(x1,y1,1,!y_in);
    find_out(x2,y2,0,!y_in);
}
void Solve(int N) {
    int v=0;
    for(int i=1;i<=2*N;i++){
        int tmp=Query(i);
        if(tmp==v+1){
            v++;
            vl.push_back(i);
        } else{
            vr.push_back(i);
        }
    }
    find_out(vl,vr,1,1);
}

Compilation message

minerals.cpp: In function 'void find_out(std::vector<int>&, std::vector<int>&, bool, bool)':
minerals.cpp:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<x.size();i++){
      |                 ~^~~~~~~~~
minerals.cpp:13:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |         if(i<x.size()/2) x1.push_back(x[i]);
      |            ~^~~~~~~~~~~
minerals.cpp:17:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int i=x.size()/2;i<x.size();i++){
      |                              ~^~~~~~~~~
minerals.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int i=0;i<x.size()/2;i++){
      |                     ~^~~~~~~~~~~
minerals.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int i=0;i<y.size();i++){
      |                     ~^~~~~~~~~
minerals.cpp:36:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         for(int i=0;i<y.size();i++){
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 4 ms 492 KB Output is correct
4 Correct 7 ms 748 KB Output is correct
5 Correct 15 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
8 Correct 7 ms 748 KB Output is correct
9 Correct 15 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 10 ms 1004 KB Output is correct
12 Correct 14 ms 1240 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 12 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
8 Correct 7 ms 748 KB Output is correct
9 Correct 15 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 10 ms 1004 KB Output is correct
12 Correct 14 ms 1240 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 12 ms 1132 KB Output is correct
15 Correct 39 ms 2668 KB Output is correct
16 Correct 51 ms 2668 KB Output is correct
17 Correct 33 ms 2536 KB Output is correct
18 Correct 33 ms 2412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
8 Correct 7 ms 748 KB Output is correct
9 Correct 15 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 10 ms 1004 KB Output is correct
12 Correct 14 ms 1240 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 12 ms 1132 KB Output is correct
15 Correct 39 ms 2668 KB Output is correct
16 Correct 51 ms 2668 KB Output is correct
17 Correct 33 ms 2536 KB Output is correct
18 Correct 33 ms 2412 KB Output is correct
19 Correct 40 ms 2692 KB Output is correct
20 Correct 40 ms 2668 KB Output is correct
21 Correct 33 ms 2536 KB Output is correct
22 Correct 41 ms 2532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
8 Correct 7 ms 748 KB Output is correct
9 Correct 15 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 10 ms 1004 KB Output is correct
12 Correct 14 ms 1240 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 12 ms 1132 KB Output is correct
15 Correct 39 ms 2668 KB Output is correct
16 Correct 51 ms 2668 KB Output is correct
17 Correct 33 ms 2536 KB Output is correct
18 Correct 33 ms 2412 KB Output is correct
19 Correct 40 ms 2692 KB Output is correct
20 Correct 40 ms 2668 KB Output is correct
21 Correct 33 ms 2536 KB Output is correct
22 Correct 41 ms 2532 KB Output is correct
23 Correct 43 ms 2644 KB Output is correct
24 Correct 42 ms 2720 KB Output is correct
25 Correct 35 ms 2664 KB Output is correct
26 Correct 40 ms 2540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
8 Correct 7 ms 748 KB Output is correct
9 Correct 15 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 10 ms 1004 KB Output is correct
12 Correct 14 ms 1240 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 12 ms 1132 KB Output is correct
15 Correct 39 ms 2668 KB Output is correct
16 Correct 51 ms 2668 KB Output is correct
17 Correct 33 ms 2536 KB Output is correct
18 Correct 33 ms 2412 KB Output is correct
19 Correct 40 ms 2692 KB Output is correct
20 Correct 40 ms 2668 KB Output is correct
21 Correct 33 ms 2536 KB Output is correct
22 Correct 41 ms 2532 KB Output is correct
23 Correct 43 ms 2644 KB Output is correct
24 Correct 42 ms 2720 KB Output is correct
25 Correct 35 ms 2664 KB Output is correct
26 Correct 40 ms 2540 KB Output is correct
27 Incorrect 47 ms 2796 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
8 Correct 7 ms 748 KB Output is correct
9 Correct 15 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 10 ms 1004 KB Output is correct
12 Correct 14 ms 1240 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 12 ms 1132 KB Output is correct
15 Correct 39 ms 2668 KB Output is correct
16 Correct 51 ms 2668 KB Output is correct
17 Correct 33 ms 2536 KB Output is correct
18 Correct 33 ms 2412 KB Output is correct
19 Correct 40 ms 2692 KB Output is correct
20 Correct 40 ms 2668 KB Output is correct
21 Correct 33 ms 2536 KB Output is correct
22 Correct 41 ms 2532 KB Output is correct
23 Correct 43 ms 2644 KB Output is correct
24 Correct 42 ms 2720 KB Output is correct
25 Correct 35 ms 2664 KB Output is correct
26 Correct 40 ms 2540 KB Output is correct
27 Incorrect 47 ms 2796 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 4 ms 492 KB Output is correct
8 Correct 7 ms 748 KB Output is correct
9 Correct 15 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 10 ms 1004 KB Output is correct
12 Correct 14 ms 1240 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 12 ms 1132 KB Output is correct
15 Correct 39 ms 2668 KB Output is correct
16 Correct 51 ms 2668 KB Output is correct
17 Correct 33 ms 2536 KB Output is correct
18 Correct 33 ms 2412 KB Output is correct
19 Correct 40 ms 2692 KB Output is correct
20 Correct 40 ms 2668 KB Output is correct
21 Correct 33 ms 2536 KB Output is correct
22 Correct 41 ms 2532 KB Output is correct
23 Correct 43 ms 2644 KB Output is correct
24 Correct 42 ms 2720 KB Output is correct
25 Correct 35 ms 2664 KB Output is correct
26 Correct 40 ms 2540 KB Output is correct
27 Incorrect 47 ms 2796 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -