답안 #128260

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
128260 2019-07-10T15:28:30 Z Osama_Alkhodairy Minerals (JOI19_minerals) C++17
40 / 100
33 ms 2164 KB
#include <bits/stdc++.h>
#include "minerals.h"
//~ #include "grader.cpp"
using namespace std;

vector <int> s, e;
int curl, curr;

void solve(int l, int r, vector <int> &cur){
    if(r < l) return;
    if(l == r){
        assert(cur.size() == 1);
        Answer(e[l], cur[0]);
        return;
    }
    int mid = (l + r) / 2;
    while(curl > l){
        l--;
        Query(e[curl]);
    }
    while(curr < r){
        curr++;
        Query(e[curr]);
    }
    while(curl < l){
        Query(e[curl]);
        curl++;
    }
    while(curr > mid){
        Query(e[curr]);
        curr--;
    }
    vector <int> left, right;
    for(auto &i : cur){
        int x = Query(i);
        if(x == mid - l + 1) left.push_back(i);
        else right.push_back(i);
        Query(i);
    }
    solve(l, mid, left);
    solve(mid + 1, r, right);
}
void Solve(int N){
    int prev = 0;
    for(int i = 1 ; i <= 2 * N ; i++){
        int cur = Query(i);
        if(cur != prev) s.push_back(i);
        else e.push_back(i);
        prev = cur;
    }
    for(auto &i : s) Query(i);
    curl = 0;
    curr = N - 1;
    solve(0, N - 1, s);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 460 KB Output is correct
3 Correct 6 ms 504 KB Output is correct
4 Correct 11 ms 760 KB Output is correct
5 Correct 24 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 11 ms 760 KB Output is correct
9 Correct 24 ms 888 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 15 ms 888 KB Output is correct
12 Correct 19 ms 1016 KB Output is correct
13 Correct 15 ms 1016 KB Output is correct
14 Correct 15 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 11 ms 760 KB Output is correct
9 Correct 24 ms 888 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 15 ms 888 KB Output is correct
12 Correct 19 ms 1016 KB Output is correct
13 Correct 15 ms 1016 KB Output is correct
14 Correct 15 ms 888 KB Output is correct
15 Incorrect 33 ms 2164 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 11 ms 760 KB Output is correct
9 Correct 24 ms 888 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 15 ms 888 KB Output is correct
12 Correct 19 ms 1016 KB Output is correct
13 Correct 15 ms 1016 KB Output is correct
14 Correct 15 ms 888 KB Output is correct
15 Incorrect 33 ms 2164 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 11 ms 760 KB Output is correct
9 Correct 24 ms 888 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 15 ms 888 KB Output is correct
12 Correct 19 ms 1016 KB Output is correct
13 Correct 15 ms 1016 KB Output is correct
14 Correct 15 ms 888 KB Output is correct
15 Incorrect 33 ms 2164 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 11 ms 760 KB Output is correct
9 Correct 24 ms 888 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 15 ms 888 KB Output is correct
12 Correct 19 ms 1016 KB Output is correct
13 Correct 15 ms 1016 KB Output is correct
14 Correct 15 ms 888 KB Output is correct
15 Incorrect 33 ms 2164 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 11 ms 760 KB Output is correct
9 Correct 24 ms 888 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 15 ms 888 KB Output is correct
12 Correct 19 ms 1016 KB Output is correct
13 Correct 15 ms 1016 KB Output is correct
14 Correct 15 ms 888 KB Output is correct
15 Incorrect 33 ms 2164 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 11 ms 760 KB Output is correct
9 Correct 24 ms 888 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 15 ms 888 KB Output is correct
12 Correct 19 ms 1016 KB Output is correct
13 Correct 15 ms 1016 KB Output is correct
14 Correct 15 ms 888 KB Output is correct
15 Incorrect 33 ms 2164 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -