Submission #251041

# Submission time Handle Problem Language Result Execution time Memory
251041 2020-07-20T01:26:59 Z IsaacMoris Minerals (JOI19_minerals) C++14
0 / 100
160 ms 149112 KB
#include<iostream>
#include <bits/stdc++.h>
#include "minerals.h"
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void solve(vector<int> & v1, vector<int> & v2, bool p)
{
    int n=v1.size();
    if(n==1)
    {
        Answer(v1.back(),v2.back());
        return ;
    }
    if(!n)
        return;
    vector<int> x1, y1, x2, y2;
    int x;
    for(int i=0; i<n; i++)
    {
        if(i<n/3)
        {
            x=Query(v1[i]);
            x1.push_back(v1[i]);
        }
        else
            x2.push_back(v1[i]);
    }
    for(auto i : v2)
    {
        int q=Query(i);
        if((q!=x && p) || (q==x && !p))
            y1.push_back(i);
        else
            y2.push_back(i);
        x=q;
    }
    v1.clear(), v2.clear();
    solve(x1,y1,!p);
    solve(x2,y2,p);
}
void Solve(int N)
{
    vector<int> v1, v2;
    int last=0;
    for (int i = 1; i <= 2 * N; ++i)
    {
        int x=Query(i);
        if(x!=last)
            v1.push_back(i);
        else
            v2.push_back(i);
        last=x;
    }
    solve(v1,v2, 1);
}

Compilation message

minerals.cpp: In function 'void solve(std::vector<int>&, std::vector<int>&, bool)':
minerals.cpp:33:14: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if((q!=x && p) || (q==x && !p))
             ~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 160 ms 148600 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 149112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -