Submission #526873

# Submission time Handle Problem Language Result Execution time Memory
526873 2022-02-16T13:15:38 Z fabijan_cikac Minerals (JOI19_minerals) C++17
0 / 100
1 ms 328 KB
#include <bits/stdc++.h>

using namespace std;

#include "minerals.h"

const int MAXN = 1e5 + 100;

vector<int> kju;

int Kuery(int x){
    return Query(x + 1);
}

void pairs(vector<int> v, int val){
    if (v.size() == 2){
        Answer(v[0] + 1, v[1] + 1); return;
    }
    vector<int> sol[2];
    if (!val){
        int cnt[2] = { 0 }; int last = -1;
        vector<int> c;
        for (int i = 0; i < v.size(); ++i){
            int rez = Kuery(v[i]);
            if (last == -1 || last == rez){
                if (cnt[0] < v.size() / 4){
                    sol[0].push_back(v[i]); ++cnt[0];
                }
                else sol[1].push_back(v[i]);
            }
            else c.push_back(v[i]);
            last = rez;
        }
        kju.clear();
        for (int i = 0; i < sol[0].size(); ++i){
            Kuery(sol[0][i]); kju.push_back(sol[0][i]);
        }
        for (int i = 0; i < c.size(); ++i){
            if (Kuery(c[i]) == v.size() / 4)
                sol[0].push_back(c[i]);
            else{
                Query(c[i]); sol[1].push_back(c[i]);
            }
        }
    }
    else{
        while (!kju.empty()){
            Kuery(kju.back()); kju.pop_back();
        }
        for (int i = 0; i < v.size(); ++i){
            if (Kuery(v[i]) > v.size() / 4){
                Kuery(v[i]); sol[1].push_back(v[i]);
            }
            else{
                kju.push_back(v[i]); sol[0].push_back(v[i]);
            }
        }
    }
    pairs(sol[0], 0); pairs(sol[1], 1);
}

void Solve(int N){
    vector<int> v;
    for (int i = 0; i < 2 * N; ++i){
        kju.push_back(i); v.push_back(i); Query(i);
    }
    pairs(v, 0);
}

/*int main(){
    int n; cin >> n;
    Solve(n);
    return 0;
}*/

Compilation message

minerals.cpp: In function 'void pairs(std::vector<int>, int)':
minerals.cpp:23:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for (int i = 0; i < v.size(); ++i){
      |                         ~~^~~~~~~~~~
minerals.cpp:26:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                 if (cnt[0] < v.size() / 4){
      |                     ~~~~~~~^~~~~~~~~~~~~~
minerals.cpp:35:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for (int i = 0; i < sol[0].size(); ++i){
      |                         ~~^~~~~~~~~~~~~~~
minerals.cpp:38:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for (int i = 0; i < c.size(); ++i){
      |                         ~~^~~~~~~~~~
minerals.cpp:39:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             if (Kuery(c[i]) == v.size() / 4)
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~
minerals.cpp:50:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         for (int i = 0; i < v.size(); ++i){
      |                         ~~^~~~~~~~~~
minerals.cpp:51:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             if (Kuery(v[i]) > v.size() / 4){
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -