QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#296335#2724. Geese vs. HawksCamillus#Compile Error//C++201.1kb2024-01-02 19:29:122024-07-04 03:16:33

Judging History

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

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

answer

/// @author Camillus <3
#define debug(...) 32
#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];
    }

    vector<vector<int>> dp(n + 1, vector<int>(n + 1));

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            if (s[i - 1] == 'W' && t[j - 1] == 'L' && a[i - 1] > t[j - 1]) {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + a[i - 1] + t[j - 1]);
            }
            if (s[i - 1] == 'L' && t[j - 1] == 'W' && a[i - 1] < t[j - 1]) {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + a[i - 1] + t[j - 1]);
            }
        }
    }

    cout << dp[n][m] << '\n';
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:44:19: error: ‘m’ was not declared in this scope
   44 |     cout << dp[n][m] << '\n';
      |                   ^