Submission #534710

# Submission time Handle Problem Language Result Execution time Memory
534710 2022-03-08T15:22:15 Z fabijan_cikac Minerals (JOI19_minerals) C++17
40 / 100
56 ms 3640 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){
    if (v.size() == 2){
        sol.push_back({v[0], v[1]});
        return;
    }
    random_shuffle(v.begin(), v.end());
    while (!q.empty()){
        if (p[q.front()]){
            int z = Query(q.front() + 1);
        }
        q.pop_front();
    }
    vector<int> a[2]; int maks = 0.61 * (v.size() / 2);
    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]); findpar(a[1]); return;
}
 
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);
    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>)':
minerals.cpp:33:17: warning: unused variable 'z' [-Wunused-variable]
   33 |             int z = Query(q.front() + 1);
      |                 ^
minerals.cpp:38:23: 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 < v.size(); ++i){
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 328 KB Output is correct
2 Correct 3 ms 456 KB Output is correct
3 Correct 8 ms 712 KB Output is correct
4 Correct 17 ms 1096 KB Output is correct
5 Correct 35 ms 1664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 8 ms 712 KB Output is correct
8 Correct 17 ms 1096 KB Output is correct
9 Correct 35 ms 1664 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 20 ms 1372 KB Output is correct
12 Correct 34 ms 1780 KB Output is correct
13 Correct 32 ms 1816 KB Output is correct
14 Correct 33 ms 1688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 8 ms 712 KB Output is correct
8 Correct 17 ms 1096 KB Output is correct
9 Correct 35 ms 1664 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 20 ms 1372 KB Output is correct
12 Correct 34 ms 1780 KB Output is correct
13 Correct 32 ms 1816 KB Output is correct
14 Correct 33 ms 1688 KB Output is correct
15 Incorrect 56 ms 3640 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 8 ms 712 KB Output is correct
8 Correct 17 ms 1096 KB Output is correct
9 Correct 35 ms 1664 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 20 ms 1372 KB Output is correct
12 Correct 34 ms 1780 KB Output is correct
13 Correct 32 ms 1816 KB Output is correct
14 Correct 33 ms 1688 KB Output is correct
15 Incorrect 56 ms 3640 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 8 ms 712 KB Output is correct
8 Correct 17 ms 1096 KB Output is correct
9 Correct 35 ms 1664 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 20 ms 1372 KB Output is correct
12 Correct 34 ms 1780 KB Output is correct
13 Correct 32 ms 1816 KB Output is correct
14 Correct 33 ms 1688 KB Output is correct
15 Incorrect 56 ms 3640 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 8 ms 712 KB Output is correct
8 Correct 17 ms 1096 KB Output is correct
9 Correct 35 ms 1664 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 20 ms 1372 KB Output is correct
12 Correct 34 ms 1780 KB Output is correct
13 Correct 32 ms 1816 KB Output is correct
14 Correct 33 ms 1688 KB Output is correct
15 Incorrect 56 ms 3640 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 8 ms 712 KB Output is correct
8 Correct 17 ms 1096 KB Output is correct
9 Correct 35 ms 1664 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 20 ms 1372 KB Output is correct
12 Correct 34 ms 1780 KB Output is correct
13 Correct 32 ms 1816 KB Output is correct
14 Correct 33 ms 1688 KB Output is correct
15 Incorrect 56 ms 3640 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 456 KB Output is correct
7 Correct 8 ms 712 KB Output is correct
8 Correct 17 ms 1096 KB Output is correct
9 Correct 35 ms 1664 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 20 ms 1372 KB Output is correct
12 Correct 34 ms 1780 KB Output is correct
13 Correct 32 ms 1816 KB Output is correct
14 Correct 33 ms 1688 KB Output is correct
15 Incorrect 56 ms 3640 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -