QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296332#2724. Geese vs. HawksCamillus#Compile Error//C++202.1kb2024-01-02 19:26:342024-07-04 03:16:33

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 03:16:33]
  • 评测
  • [2024-01-02 19:26:34]
  • 提交

answer

/// @author Camillus <3
#include "bits/stdc++.h"
#define int long long
using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    string s;
    cin >> s;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    string t;
    cin >> t;

    vector<int> b(n);
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }

    int sum = 0;

    {
        vector<int> W;
        vector<int> L;

        for (int i = 0; i < n; i++) {
            if (s[i] == 'W') {
                W.push_back(a[i]);
            }

            if (t[i] == 'L') {
                L.push_back(b[i]);
            }
        }

        debug(W);
        debug(L);

        int N = (int)W.size();
        int M = (int)L.size();

        vector<vector<int>> dp(N + 1, vector<int>(M + 1));

        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= M; j++) {
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
                if (W[i - 1] > L[j - 1]) {
                    dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + W[i - 1] + L[j - 1]);
                }
            }
        }

        sum += dp[N][M];
    }

    {
        vector<int> W;
        vector<int> L;

        for (int i = 0; i < n; i++) {
            if (s[i] == 'L') {
                L.push_back(a[i]);
            }

            if (t[i] == 'W') {
                W.push_back(b[i]);
            }
        }

        debug(W);
        debug(L);

        int N = (int)W.size();
        int M = (int)L.size();

        vector<vector<int>> dp(N + 1, vector<int>(M + 1));

        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= M; j++) {
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
                if (W[i - 1] > L[j - 1]) {
                    dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + W[i - 1] + L[j - 1]);
                }
            }
        }

        sum += dp[N][M];
    }

    cout << sum << '\n';
    return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:45:9: error: ‘debug’ was not declared in this scope
   45 |         debug(W);
      |         ^~~~~
answer.code:79:9: error: ‘debug’ was not declared in this scope
   79 |         debug(W);
      |         ^~~~~