답안 #873408

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
873408 2023-11-15T03:13:32 Z Faisal_Saqib The Collection Game (BOI21_swaps) C++17
0 / 100
18 ms 688 KB
//
// --- Sample implementation for the task swaps ---
//
// To compile this program with the sample grader, place:
//     swaps.h swaps_sample.cpp sample_grader.cpp
// in a single folder and run:
//     g++ swaps_sample.cpp sample_grader.cpp
// in this folder.
//
#include "swaps.h"
#include <iostream>
#include <vector>
using namespace std;
bool pos=1;
vector<int> DNC(int l,int r)
{
    if(l==r)
        return {l};
    int mid=(l+r)/2;
    vector<int> final,fh=DNC(l,mid),sh=DNC(mid+1,r);
    int i=0,j=0;
    while(i<fh.size() and j<sh.size())
    {
        schedule(fh[i],sh[j]);
        int p=visit()[0];
        if(p)
            final.push_back(fh[i++]);
        else
        {
            pos=0;
            final.push_back(sh[j++]);
        }
    }
    while(i<fh.size())
        final.push_back(fh[i++]);
    while(j<sh.size())
        final.push_back(sh[j++]);
    return final;
}
void solve(int n, int v) {
    pos=1;
    auto pa=DNC(1,n);
    if(pos)
        exit(-100);
    answer(pa);
}

Compilation message

swaps.cpp: In function 'std::vector<int> DNC(int, int)':
swaps.cpp:22:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     while(i<fh.size() and j<sh.size())
      |           ~^~~~~~~~~~
swaps.cpp:22:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     while(i<fh.size() and j<sh.size())
      |                           ~^~~~~~~~~~
swaps.cpp:34:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     while(i<fh.size())
      |           ~^~~~~~~~~~
swaps.cpp:36:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     while(j<sh.size())
      |           ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 432 KB Correct
3 Correct 7 ms 428 KB Correct
4 Correct 18 ms 440 KB Correct
5 Runtime error 9 ms 440 KB Execution failed because the return code was nonzero
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 436 KB Correct
3 Correct 6 ms 516 KB Correct
4 Correct 15 ms 688 KB Correct
5 Runtime error 10 ms 440 KB Execution failed because the return code was nonzero
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 596 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 596 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -