답안 #980698

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980698 2024-05-12T10:28:52 Z Jarif_Rahman Minerals (JOI19_minerals) C++17
6 / 100
12 ms 1716 KB
#include "minerals.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

int cnt = 0;

void pbs(int l, int r, bool right, bool reset, vector<int> X){
    if(l == r){
        for(int i: X) if(i < l) Answer(i, l);
        return;
    }

    int md = (l+r)/2;
    if(right) for(int i = l; i <= md; i++) cnt = Query(i);
    else for(int i = r; i > md; i--) cnt = Query(i);
    vector<int> A, B;
    for(int i: X){
        if(i > md){
            B.push_back(i);
            continue;
        }
        int cnt_ = Query(i);
        if(cnt_ == cnt) A.push_back(i);
        else B.push_back(i);
        Query(i);
    }

    pbs(md+1, r, 1, 1, B);
    pbs(l, md, 0, reset, A);
    if(reset){
        if(right) for(int i = l; i <= md; i++) cnt = Query(i);
        else for(int i = r; i > md; i--) cnt = Query(i);
    }
}

void Solve(int n){
    vector<int> X;
    for(int i = 1; i <= 2*n; i++) X.push_back(i);
    pbs(1, 2*n, 1, 0, X);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 8 ms 1112 KB Output is correct
5 Incorrect 12 ms 1716 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 8 ms 1112 KB Output is correct
9 Incorrect 12 ms 1716 KB Wrong Answer [2]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 8 ms 1112 KB Output is correct
9 Incorrect 12 ms 1716 KB Wrong Answer [2]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 8 ms 1112 KB Output is correct
9 Incorrect 12 ms 1716 KB Wrong Answer [2]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 8 ms 1112 KB Output is correct
9 Incorrect 12 ms 1716 KB Wrong Answer [2]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 8 ms 1112 KB Output is correct
9 Incorrect 12 ms 1716 KB Wrong Answer [2]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 8 ms 1112 KB Output is correct
9 Incorrect 12 ms 1716 KB Wrong Answer [2]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 8 ms 1112 KB Output is correct
9 Incorrect 12 ms 1716 KB Wrong Answer [2]
10 Halted 0 ms 0 KB -