Submission #789198

# Submission time Handle Problem Language Result Execution time Memory
789198 2023-07-21T07:31:43 Z 반딧불(#10041) Chorus (JOI23_chorus) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

void input();
void solve();

int main(){
    input();
    solve();
}

int n, k;
ll arr[1000002]; /// A = ( = 1, B = ) = -1
ll revArr[1000002]; /// revArr[x]: arr[i] >= x�� �Ǵ� �ּ� i
ll sum[1000002];
char str[2000002];

void input(){
    scanf("%d %d", &n, &k);
    scanf("%s", str+1);
    int aCnt = 0, bCnt = 0;
    for(int i=1; i<=n+n; i++){
        if(str[i] == 'A') ++aCnt;
        else arr[++bCnt] = aCnt;
    }
    arr[n+1] = n+1;
    int pnt = 1;
    for(int i=arr[1]; i<=n; i++){
        while(arr[pnt] < i) pnt++;
        revArr[i] = pnt;
    }
    for(int i=1; i<=n; i++) sum[i] = sum[i-1] + arr[i];
}

ll cost(int s, int e){
    int r = min(e, (int)revArr[e] - 1);
    if(s>r) return 0;
    return ll(e) * (r-s+1) - (sum[r] - sum[s-1]);
}

void solve(){


    printf("%lld", DP[k][n]);
}

Compilation message

chorus.cpp: In function 'void solve()':
chorus.cpp:47:20: error: 'DP' was not declared in this scope
   47 |     printf("%lld", DP[k][n]);
      |                    ^~
chorus.cpp: In function 'void input()':
chorus.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
chorus.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     scanf("%s", str+1);
      |     ~~~~~^~~~~~~~~~~~~