답안 #250098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
250098 2020-07-17T02:36:42 Z dwsc Minerals (JOI19_minerals) C++14
0 / 100
2 ms 640 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
void solve(vector<int> v1,vector<int> v2){
    if (v1.size() == 1){
        Query(v1[0]);
        Answer(v1[0],v2[0]);
        return;
    }
    //cout << v1.size() << " " << v2.size() << "\n";
    int stop = v1.size()/2;
    vector<int> v1a,v1b,v2a,v2b;
    for (int i = 0; i < v1.size(); i++){
        if (i < stop){
            v1a.push_back(v1[i]);
        }
        else{
            Query(v1[i]);
            v1b.push_back(v1[i]);
        }
    }
    int num = stop;
    for (int i = 0; i < v2.size(); i++){
        if (Query(v2[i]) > num){
            v2b.push_back(v2[i]);
        }
        else v2a.push_back(v2[i]);
        Query(v2[i]);
    }
    solve(v1a,v2a);
    for (int i = 0; i < v2a.size(); i++) Query(v1b[i]);
    solve(v1b,v2b);
}
void Solve(int N) {
    vector<int> v1,v2;
    int num = 0;
    for (int i = 1; i <= 2*N; i++){
        int temp = Query(i);
        if (temp > num){
            num++;
            v1.push_back(i);
        }
        else{
            Query(i);
            v2.push_back(i);
        }
    }
    //for (int i = 0; i < v1.size(); i++) Query(v1[i]);
    solve(v1,v2);
}

Compilation message

minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>)':
minerals.cpp:13:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < v1.size(); i++){
                     ~~^~~~~~~~~~~
minerals.cpp:23:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < v2.size(); i++){
                     ~~^~~~~~~~~~~
minerals.cpp:31:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < v2a.size(); i++) Query(v1b[i]);
                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -