답안 #794713

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
794713 2023-07-26T19:44:55 Z AbdullahMohammedAhmad Minerals (JOI19_minerals) C++14
0 / 100
2 ms 464 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

void Solve(int N) {
    deque<int> in;
    deque<int> order;
    int prev_ans = 0, ans = 0;
    for(int i = 1; i <= 2*N; i++){order.push_back(i);}
    while(!order.empty())
    {
        in.push_back(order.front());
        ans = Query(order.front());
        order.pop_front();
        if(ans != prev_ans){prev_ans = ans; continue;}
        vector<int> toput;
        while(true)
        {
            prev_ans = ans;
            int now = in.front();
            ans = Query(now);
            in.pop_front();
            if(ans != prev_ans)
            {
                toput.push_back(now);
            }
            else
            {
                Answer(now, in.back());
                in.pop_back();
                break;
            }
        }
        int dist = (int)order.size()/(int)toput.size();
        int idx = dist;
        for(auto x : toput)
        {
            if(idx >= order.size())
            {
                order.push_back(x);
                idx+=dist;
                continue;
            }
            order.insert(order.begin()+idx, x);
            idx+=dist;
        }
    }
}

Compilation message

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:38:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             if(idx >= order.size())
      |                ~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 464 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -