Submission #203327

# Submission time Handle Problem Language Result Execution time Memory
203327 2020-02-20T08:23:38 Z theStaticMind Minerals (JOI19_minerals) C++14
40 / 100
39 ms 2620 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"

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 < n; i++){
            Query(A[i]);
      }
      int last = n;

      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;
      }
      for(int i = 0; i < n; i++) Query(A[i]);
      for(int i = 0; i < m; i++) Query(B[i]);
}

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]);
      extract(tempA, B, X, Y);
      divide(tempA, X);
      divide(tempB, Y);
}

void Solve(int N) {
      vector<int> A, B;
      int last = 0;
      for(int i = 1; i <= 2 * N; i++){
            int q = Query(i);
            if(last == q){
                  B.pb(i);
            }
            else{
                  A.pb(i);
            }
            last = q;
      }
      for(int i = 1; i <= 2 * N; i++) Query(i);
      divide(A, B);
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 504 KB Output is correct
2 Correct 7 ms 504 KB Output is correct
3 Correct 9 ms 504 KB Output is correct
4 Correct 15 ms 760 KB Output is correct
5 Correct 24 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 7 ms 504 KB Output is correct
6 Correct 7 ms 504 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 15 ms 760 KB Output is correct
9 Correct 24 ms 1016 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 22 ms 888 KB Output is correct
12 Correct 29 ms 1144 KB Output is correct
13 Correct 24 ms 1144 KB Output is correct
14 Correct 24 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 7 ms 504 KB Output is correct
6 Correct 7 ms 504 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 15 ms 760 KB Output is correct
9 Correct 24 ms 1016 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 22 ms 888 KB Output is correct
12 Correct 29 ms 1144 KB Output is correct
13 Correct 24 ms 1144 KB Output is correct
14 Correct 24 ms 1016 KB Output is correct
15 Incorrect 39 ms 2620 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 7 ms 504 KB Output is correct
6 Correct 7 ms 504 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 15 ms 760 KB Output is correct
9 Correct 24 ms 1016 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 22 ms 888 KB Output is correct
12 Correct 29 ms 1144 KB Output is correct
13 Correct 24 ms 1144 KB Output is correct
14 Correct 24 ms 1016 KB Output is correct
15 Incorrect 39 ms 2620 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 7 ms 504 KB Output is correct
6 Correct 7 ms 504 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 15 ms 760 KB Output is correct
9 Correct 24 ms 1016 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 22 ms 888 KB Output is correct
12 Correct 29 ms 1144 KB Output is correct
13 Correct 24 ms 1144 KB Output is correct
14 Correct 24 ms 1016 KB Output is correct
15 Incorrect 39 ms 2620 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 7 ms 504 KB Output is correct
6 Correct 7 ms 504 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 15 ms 760 KB Output is correct
9 Correct 24 ms 1016 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 22 ms 888 KB Output is correct
12 Correct 29 ms 1144 KB Output is correct
13 Correct 24 ms 1144 KB Output is correct
14 Correct 24 ms 1016 KB Output is correct
15 Incorrect 39 ms 2620 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 7 ms 504 KB Output is correct
6 Correct 7 ms 504 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 15 ms 760 KB Output is correct
9 Correct 24 ms 1016 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 22 ms 888 KB Output is correct
12 Correct 29 ms 1144 KB Output is correct
13 Correct 24 ms 1144 KB Output is correct
14 Correct 24 ms 1016 KB Output is correct
15 Incorrect 39 ms 2620 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 7 ms 504 KB Output is correct
6 Correct 7 ms 504 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 15 ms 760 KB Output is correct
9 Correct 24 ms 1016 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 22 ms 888 KB Output is correct
12 Correct 29 ms 1144 KB Output is correct
13 Correct 24 ms 1144 KB Output is correct
14 Correct 24 ms 1016 KB Output is correct
15 Incorrect 39 ms 2620 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -