Submission #203330

# Submission time Handle Problem Language Result Execution time Memory
203330 2020-02-20T08:51:46 Z theStaticMind Minerals (JOI19_minerals) C++14
0 / 100
5 ms 376 KB
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define INF 1000000000//00000000
#define modulo 1000000007
#define mod 998244353
//#define int long long int
using namespace std;

#include "minerals.h"

int last = 0;

void extract(vector<int>& A, vector<int>& B, vector<int>& X, vector<int>& Y){
      int n = sz(A), m = sz(B);

      for(int i = 0; i < m; i++){
            int v = Query(B[i]);
            if(v == last){
                  X.pb(B[i]);
            }
            else Y.pb(B[i]);
            last = v;
      }
}

void divide(vector<int>& A, vector<int>& B){
      int n = A.size();
      if(n == 1){
            Answer(A[0], B[0]);
            return;
      }
      vector<int> X, Y;
      vector<int> tempA, tempB;
      for(int i = 0; i < n / 2; i++)tempA.pb(A[i]);
      for(int i = n / 2; i < n; i++)tempB.pb(A[i]), last = Query(A[i]);
      extract(tempA, B, X, Y);
      divide(tempA, X);
      divide(tempB, Y);
}

void Solve(int N) {
      vector<int> A, B;

      for(int i = 1; i <= 2 * N; i++){
            int q = Query(i);
            if(last == q){
                  B.pb(i);
            }
            else{
                  A.pb(i);
            }
            last = q;
      }
      divide(A, B);
}

Compilation message

minerals.cpp: In function 'void extract(std::vector<int>&, std::vector<int>&, std::vector<int>&, std::vector<int>&)':
minerals.cpp:17:11: warning: unused variable 'n' [-Wunused-variable]
       int n = sz(A), m = sz(B);
           ^
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -