답안 #1022984

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1022984 2024-07-14T08:22:42 Z gyg The Collection Game (BOI21_swaps) C++17
27 / 100
38 ms 1408 KB
#include "swaps.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int MAX_N = 5e2 + 5;

int n;
array<int, MAX_N> n_beats;

void solve(int _n, int _v) {
    n = _n;

    int x = 1, y = 1;
    while (!(x == n - 1 && y == n)) {
        if (y != n) y++;
        else x++;

        vector<pii> queries;
        int i = 0;
        while (true) {
            int new_x = x + i, new_y = y - i;
            if (new_y <= new_x) break;
            // Checks for repeats needed
            queries.push_back({new_x, new_y});
            schedule(new_x, new_y);
            i++;
        }
        
        vector<int> resp = visit();
        for (int i = 0; i < queries.size(); i++) {
            if (resp[i] == 1) n_beats[queries[i].first]++;
            else n_beats[queries[i].second]++;
        }
    }

    // for (int i = 1; i <= n; i++) {
    //     cerr << i << ": " << n_beats[i] << endl;
    // }

    vector<int> ans(n);
    for (int i = 1; i <= n; i++) 
        ans[n - n_beats[i] - 1] = i;
    answer(ans);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:30:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for (int i = 0; i < queries.size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 600 KB Correct
3 Correct 8 ms 600 KB Correct
4 Correct 28 ms 452 KB Correct
5 Correct 26 ms 456 KB Correct
6 Correct 27 ms 448 KB Correct
7 Correct 29 ms 588 KB Correct
8 Correct 38 ms 704 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 8 ms 440 KB Correct
4 Correct 32 ms 716 KB Correct
5 Correct 28 ms 452 KB Correct
6 Correct 30 ms 708 KB Correct
7 Correct 28 ms 780 KB Correct
8 Correct 25 ms 456 KB Correct
9 Correct 35 ms 1408 KB Correct
10 Correct 25 ms 452 KB Correct
11 Correct 27 ms 600 KB Correct
12 Correct 27 ms 448 KB Correct
13 Correct 34 ms 688 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Incorrect 0 ms 344 KB Not correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 436 KB Correct
3 Correct 8 ms 440 KB Correct
4 Correct 38 ms 592 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 436 KB Correct
3 Correct 8 ms 440 KB Correct
4 Correct 38 ms 592 KB Correct
5 Correct 0 ms 344 KB Correct
6 Correct 2 ms 344 KB Correct
7 Correct 10 ms 600 KB Correct
8 Correct 31 ms 628 KB Correct
9 Correct 31 ms 504 KB Correct
10 Correct 30 ms 448 KB Correct
11 Correct 26 ms 452 KB Correct
12 Correct 27 ms 452 KB Correct
13 Incorrect 0 ms 344 KB Not correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 8 ms 344 KB Correct
4 Correct 27 ms 452 KB Correct
5 Runtime error 17 ms 600 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 8 ms 344 KB Correct
4 Correct 27 ms 452 KB Correct
5 Runtime error 17 ms 600 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 7 ms 440 KB Correct
4 Correct 31 ms 444 KB Correct
5 Runtime error 16 ms 600 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 7 ms 440 KB Correct
4 Correct 31 ms 444 KB Correct
5 Runtime error 16 ms 600 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 8 ms 444 KB Correct
4 Correct 30 ms 468 KB Correct
5 Runtime error 15 ms 808 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 8 ms 444 KB Correct
4 Correct 30 ms 468 KB Correct
5 Runtime error 15 ms 808 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -