답안 #1039536

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1039536 2024-07-31T03:45:55 Z 12345678 The Collection Game (BOI21_swaps) C++17
25 / 100
64 ms 956 KB
#include "swaps.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=505;

int vs[nx];

int getmax(vector<int> qrs)
{
    while (qrs.size()>1)
    {
        vector<int> nxt;
        if (qrs.size()%2) nxt.push_back(qrs.back()), qrs.pop_back();
        for (int i=0; i<qrs.size(); i+=2) schedule(qrs[i], qrs[i+1]);
        auto v=visit();
        for (int i=0; i<v.size(); i++) 
        {
            if (v[i]) nxt.push_back(qrs[2*i]);
            else nxt.push_back(qrs[2*i+1]);
        }
        qrs=nxt;
    }
    return qrs[0];
}

void solve(int N, int V) {
    vector<int> res;
    for (int i=1; i<=N; i++)
    {
        vector<int> qrs;
        for (int j=1; j<=N; j++) if (!vs[j]) qrs.push_back(j);
        auto tmp=getmax(qrs);
        //cout<<"debug "<<tmp<<'\n';
        res.push_back(tmp);
        vs[tmp]=1;
    }
    answer(res);
}

Compilation message

swaps.cpp: In function 'int getmax(std::vector<int>)':
swaps.cpp:16:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for (int i=0; i<qrs.size(); i+=2) schedule(qrs[i], qrs[i+1]);
      |                       ~^~~~~~~~~~~
swaps.cpp:18:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int i=0; i<v.size(); i++)
      |                       ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 5 ms 344 KB Correct
3 Correct 19 ms 700 KB Correct
4 Correct 50 ms 604 KB Correct
5 Correct 47 ms 344 KB Correct
6 Correct 44 ms 344 KB Correct
7 Correct 56 ms 536 KB Correct
8 Correct 48 ms 460 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 4 ms 440 KB Correct
3 Correct 14 ms 600 KB Correct
4 Correct 45 ms 712 KB Correct
5 Correct 41 ms 456 KB Correct
6 Correct 63 ms 688 KB Correct
7 Correct 57 ms 704 KB Correct
8 Correct 46 ms 700 KB Correct
9 Runtime error 15 ms 436 KB Execution killed with signal 13
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 344 KB Correct
3 Correct 0 ms 344 KB Correct
4 Correct 4 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 5 ms 676 KB Correct
3 Correct 14 ms 344 KB Correct
4 Correct 64 ms 696 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 5 ms 676 KB Correct
3 Correct 14 ms 344 KB Correct
4 Correct 64 ms 696 KB Correct
5 Correct 1 ms 344 KB Correct
6 Correct 5 ms 440 KB Correct
7 Correct 14 ms 448 KB Correct
8 Correct 52 ms 956 KB Correct
9 Correct 47 ms 692 KB Correct
10 Correct 48 ms 440 KB Correct
11 Correct 47 ms 456 KB Correct
12 Correct 52 ms 456 KB Correct
13 Correct 0 ms 344 KB Correct
14 Correct 5 ms 440 KB Correct
15 Correct 19 ms 452 KB Correct
16 Correct 54 ms 424 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 444 KB Correct
3 Correct 19 ms 600 KB Correct
4 Correct 45 ms 452 KB Correct
5 Runtime error 11 ms 500 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 444 KB Correct
3 Correct 19 ms 600 KB Correct
4 Correct 45 ms 452 KB Correct
5 Runtime error 11 ms 500 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 6 ms 448 KB Correct
3 Correct 20 ms 692 KB Correct
4 Correct 43 ms 344 KB Correct
5 Runtime error 8 ms 764 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 6 ms 448 KB Correct
3 Correct 20 ms 692 KB Correct
4 Correct 43 ms 344 KB Correct
5 Runtime error 8 ms 764 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 5 ms 344 KB Correct
3 Correct 14 ms 464 KB Correct
4 Correct 47 ms 948 KB Correct
5 Runtime error 7 ms 344 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 5 ms 344 KB Correct
3 Correct 14 ms 464 KB Correct
4 Correct 47 ms 948 KB Correct
5 Runtime error 7 ms 344 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -