Submission #525058

# Submission time Handle Problem Language Result Execution time Memory
525058 2022-02-10T15:19:23 Z fabijan_cikac Minerals (JOI19_minerals) C++17
0 / 100
66 ms 63040 KB
#include <bits/stdc++.h>
 
using namespace std;
 
#include "minerals.h"
 
const int MAXN = (1 << 17);
 
#define F first
#define S second
#define pp pair<int, int>
 
vector<pp> sol;
deque<int> q;
int p[MAXN] = { 0 };
 
/*int Query(int x){
    int y; cin >> y; return y;
}
 
void Answer(int x, int y){
    return;
}*/
 
void findpar(vector<int> v, int val){
    if (v.size() == 2){
        sol.push_back({v[0], v[1]});
        return;
    }
    if (!val){
        vector<int> a[2]; int maks = v.size() / 4;
        int zad = -1; bool b = false;
        for (int i = 0; i < v.size(); ++i){
            int x = Query(v[i] + 1); q.push_back(v[i]); p[v[i]] = 0;
            bool b2 = false;
            if ((zad == -1) || (zad == x && b) || (zad == x + 1 && x >= maks)){
                a[0].push_back(v[i]); b2 = true;
            }
            else{
                Query(v[i] + 1); a[1].push_back(v[i]); p[v[i]] = 1;
            }
            zad = x; b = b2;
        }
        findpar(a[0], 0); findpar(a[1], 1);
    }
    else{
        while (!q.empty()){
            if (p[q.front()]){
                int z = Query(q.front() + 1);
            }
            q.pop_front();
        }
        vector<int> a[2]; int maks = v.size() / 4;
        for (int i = 0; i < v.size(); ++i){
            int x = Query(v[i] + 1); q.push_back(v[i]); p[v[i]] = 1;
            if (x > maks){
                Query(v[i] + 1); a[1].push_back(v[i]); p[v[i]] = 0;
            }
            else a[0].push_back(v[i]);
        }
        findpar(a[0], 0); findpar(a[1], 1);
    }
}
 
void Solve(int N){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    vector<int> v;
    for (int i = 0; i < 2 * N; ++i)
        v.push_back(i);
    findpar(v, 1);
    for (int i = 0; i < N; ++i)
        Answer(sol[i].F + 1, sol[i].S + 1);
}

Compilation message

minerals.cpp: In function 'void findpar(std::vector<int>, int)':
minerals.cpp:33:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         for (int i = 0; i < v.size(); ++i){
      |                         ~~^~~~~~~~~~
minerals.cpp:49:21: warning: unused variable 'z' [-Wunused-variable]
   49 |                 int z = Query(q.front() + 1);
      |                     ^
minerals.cpp:54:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for (int i = 0; i < v.size(); ++i){
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 13128 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 63040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -