Submission #137927

# Submission time Handle Problem Language Result Execution time Memory
137927 2019-07-28T14:15:15 Z zoooma13 Minerals (JOI19_minerals) C++14
25 / 100
282 ms 262148 KB
#include "bits/stdc++.h"
#include "minerals.h"
using namespace std;

void go(vector<int> h1 ,vector<int> h2){
    if(h1.size() == 1 && h2.size() == 1){
        Answer(h1.front() ,h2.front());
        return;
    }

    vector <int> nh1 = vector<int>{h1.begin() ,h1.begin()+h1.size()/2};
    vector <int> nh2 = vector<int>{h1.begin()+h1.size()/2 ,h1.end()};
    for(int i=0; i<nh1.size(); i++)
        Query(nh1[i]);

    vector <int> mh1 ,mh2;
    for(int i=0; i<h2.size(); i++){
        if(Query(h2[i]) == nh1.size())
            mh1.push_back(h2[i]);
        else
            mh2.push_back(h2[i]);
        Query(h2[i]);
    }

    for(int i=0; i<nh1.size(); i++)
        Query(nh1[i]);

    if(nh1.size()) go(nh1 ,mh1);
    if(nh2.size()) go(nh2 ,mh2);
}

void Solve(int N) {
    vector <int> h1(N);
    iota(h1.begin() ,h1.end() ,1);
    vector <int> h2(N);
    iota(h2.begin() ,h2.end() ,N+1);
    go(h1 ,h2);
}

Compilation message

minerals.cpp: In function 'void go(std::vector<int>, std::vector<int>)':
minerals.cpp:13:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<nh1.size(); i++)
                  ~^~~~~~~~~~~
minerals.cpp:17:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<h2.size(); i++){
                  ~^~~~~~~~~~
minerals.cpp:18:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(Query(h2[i]) == nh1.size())
            ~~~~~~~~~~~~~^~~~~~~~~~~~~
minerals.cpp:25:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<nh1.size(); i++)
                  ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 380 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
4 Correct 13 ms 760 KB Output is correct
5 Correct 22 ms 1308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 282 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -