Submission #1077517

# Submission time Handle Problem Language Result Execution time Memory
1077517 2024-08-27T07:48:00 Z azberjibiou Minerals (JOI19_minerals) C++17
0 / 100
158 ms 262144 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
 
int solv(vector <int> v, int pval, bool ud){
    int sz=v.size()/2;
    if(sz==1){
        Answer(v[0], v[1]);
        return pval;
    }
    int mid=sz/2;
    vector <int> nv1, nv2;
    int tmp;
    for(int i=0;i<2*sz;i++){
        int now=Query(v[i]);
        if((ud && now>pval+mid) || (!ud && now<pval-mid)){
            nv1.push_back(v[i]);
            tmp=Query(v[i]);
        }
        else{
            nv2.push_back(v[i]);
            tmp=now;
        }
    }
    int nxtv=solv(nv1, tmp, ud);
    return solv(nv2, nxtv, ud^1);
}
void Solve(int N) {
    vector <int> v;
    for(int i=1;i<=2*N;i++) v.push_back(i);
    solv(v, 0, 1);
}

Compilation message

minerals.cpp: In function 'int solv(std::vector<int>, int, bool)':
minerals.cpp:25:18: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |     int nxtv=solv(nv1, tmp, ud);
      |              ~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 153 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 158 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -