Submission #1331702

#TimeUsernameProblemLanguageResultExecution timeMemory
1331702nguyengiabach1201Ancient Machine (JOI21_ancient_machine)C++20
Compilation error
0 ms0 KiB
#include "Anna.h"
#include <vector>

void Anna(int N, std::vector<char> S) {
    for (int i = 0; i < N; i++) {
        if (S[i] == 'X') {
            Send(0); Send(0);
        } else if (S[i] == 'Y') {
            Send(0); Send(1);
        } else if (S[i] == 'Z') {
            Send(1); Send(0);
        }
    }
}
#include "Bruno.h"
#include <vector>
#include <stack>

void Bruno(int N, int L, std::vector<int> A) {
    std::vector<char> S(N);
    for (int i = 0; i < N; i++) {
        int b1 = A[i * 2];
        int b2 = A[i * 2 + 1];
        if (b1 == 0 && b2 == 0) S[i] = 'X';
        else if (b1 == 0 && b2 == 1) S[i] = 'Y';
        else S[i] = 'Z';
    }

    std::vector<bool> removed(N, false);
    std::vector<int> x_indices;
    std::vector<pair<int, int>> xy_pairs; // Lưu cặp (X, Y)
    std::vector<int> good_y; // Các Y tạo thành good removal

    // Bước 1: Tìm các bộ (X, Y, Z) tiềm năng
    int last_x = -1;
    std::vector<int> current_x_stack;
    
    // Logic đơn giản: Tìm X, sau đó tìm Y gần nhất, sau đó tìm Z gần nhất
    // Lưu ý: Đây là logic cơ bản, bạn có thể tối ưu thêm để đạt điểm tối đa
    std::vector<int> order;
    // ... thực hiện logic tìm kiếm và đẩy vào order ...

    // Bruno phải gọi Remove(d) đúng N lần [cite: 57]
    for (int i = 0; i < N; i++) {
        // Thứ tự xóa quan trọng: Xóa các thiết bị không tạo good removal trước,
        // sau đó xóa Y trong bộ (X, Y, Z) để tính điểm[cite: 15].
        // Ví dụ tạm thời: xóa theo thứ tự 0 đến N-1
        Remove(i); 
    }
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:17:17: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   17 |     std::vector<pair<int, int>> xy_pairs; // Lưu cặp (X, Y)
      |                 ^~~~
      |                 std::pair
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/vector:62,
                 from Bruno.h:1,
                 from Bruno.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
Bruno.cpp:17:30: error: template argument 1 is invalid
   17 |     std::vector<pair<int, int>> xy_pairs; // Lưu cặp (X, Y)
      |                              ^~
Bruno.cpp:17:30: error: template argument 2 is invalid