QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#414147#7996. 报数 IVAcetaminophenCompile Error//C++111.2kb2024-05-18 15:53:142024-05-18 15:53:16

Judging History

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

  • [2024-05-18 15:53:16]
  • 评测
  • [2024-05-18 15:53:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int a[3000],b[3000];
int dp[3000][3000]={0};//0上面,1下面
int ans=10000000;
//void dfs(int l,int r,int cnt){
//  if(cnt>=ans){
//      return;
//  }
//  if(l==0||r==0){
//      ans=min(ans,cnt);
//      return;
//  }
//  if(a[l]!=b[r]&&a[l]!=1&&b[r]!=1){
//      dfs(--l,r,cnt+1);
//      dfs(l,--r,cnt+1);
//  }else{
//      dfs(--l,--r,cnt);
//  }
//}
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=m;i++){
        scanf("%d",&b[i]);
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            dp[i][j]=10000000;
        }
    }
    int l=n,r=m;
    dp[l][r]=0;
    while(l>0&&r>0){
        if(a[l]!=b[r]&&a[l]!=1&&b[r]!=1){
            int temp1=min(dp[l-1][r],dp[l][r]+1),temp2=min(dp[l][r-1],dp[l][r]+1);
            dp[--l][r]=temp1;
            dp[l][--r]=temp2;
        }else{
            int temp3=min(dp[l-1][r-1],dp[l][r]);
            dp[--l][--r]=temp3;
        }
    }
    printf("%d",min(dp[0][r],dp[l][0]));
    return 0;
}

Details

answer.code:22:1: error: extended character   is not valid in an identifier
   22 |     int n,m;
      | ^
answer.code:22:3: error: extended character   is not valid in an identifier
   22 |     int n,m;
      |   ^
answer.code:23:1: error: extended character   is not valid in an identifier
   23 |     scanf("%d %d",&n,&m);
      | ^
answer.code:23:3: error: extended character   is not valid in an identifier
   23 |     scanf("%d %d",&n,&m);
      |   ^
answer.code:24:1: error: extended character   is not valid in an identifier
   24 |     for(int i=1;i<=n;i++){
      | ^
answer.code:24:3: error: extended character   is not valid in an identifier
   24 |     for(int i=1;i<=n;i++){
      |   ^
answer.code:25:1: error: extended character   is not valid in an identifier
   25 |         scanf("%d",&a[i]);
      | ^
answer.code:25:3: error: extended character   is not valid in an identifier
   25 |         scanf("%d",&a[i]);
      |   ^
answer.code:25:5: error: extended character   is not valid in an identifier
   25 |         scanf("%d",&a[i]);
      |     ^
answer.code:25:7: error: extended character   is not valid in an identifier
   25 |         scanf("%d",&a[i]);
      |       ^
answer.code:26:1: error: extended character   is not valid in an identifier
   26 |     }
      | ^
answer.code:26:3: error: extended character   is not valid in an identifier
   26 |     }
      |   ^
answer.code:27:1: error: extended character   is not valid in an identifier
   27 |     for(int i=1;i<=m;i++){
      | ^
answer.code:27:3: error: extended character   is not valid in an identifier
   27 |     for(int i=1;i<=m;i++){
      |   ^
answer.code:28:1: error: extended character   is not valid in an identifier
   28 |         scanf("%d",&b[i]);
      | ^
answer.code:28:3: error: extended character   is not valid in an identifier
   28 |         scanf("%d",&b[i]);
      |   ^
answer.code:28:5: error: extended character   is not valid in an identifier
   28 |         scanf("%d",&b[i]);
      |     ^
answer.code:28:7: error: extended character   is not valid in an identifier
   28 |         scanf("%d",&b[i]);
      |       ^
answer.code:29:1: error: extended character   is not valid in an identifier
   29 |     }
      | ^
answer.code:29:3: error: extended character   is not valid in an identifier
   29 |     }
      |   ^
answer.code:30:1: error: extended character   is not valid in an identifier
   30 |     for(int i=0;i<=n;i++){
      | ^
answer.code:30:3: error: extended character   is not valid in an identifier
   30 |     for(int i=0;i<=n;i++){
      |   ^
answer.code:31:1: error: extended character   is not valid in an identifier
   31 |         for(int j=0;j<=m;j++){
      | ^
answer.code:31:3: error: extended character   is not valid in an identifier
   31 |         for(int j=0;j<=m;j++){
      |   ^
answer.code:31:5: error: extended character   is not valid in an identifier
   31 |         for(int j=0;j<=m;j++){
      |     ^
answer.code:31:7: error: extended character   is not valid in an identifier
   31 |         for(int j=0;j<=m;j++){
      |       ^
answer.code:32:1: error: extended character   is not valid in an identifier
   32 |             dp[i][j]=10000000;
      | ^
answer.code:32:3: error: extended character   is not valid in an identifier
   32 |             dp[i][j]=10000000;
      |   ^
answer.code:32:5: error: extended character   is not valid in an identifier
   32 |             dp[i][j]=10000000;
      |     ^
answer.code:32:7: error: extended character   is not valid in an identifier
   32 |             dp[i][j]=10000000;
      |       ^
answer.code:32:9: error: extended character   is not valid in an identifier
   32 |             dp[i][j]=10000000;
      |         ^
answer.code:32:11: error: extended character   is not valid in an identifier
   32 |             dp[i][j]=10000000;
      |           ^
answer.code:33:1: error: extended character   is not valid in an identifier
   33 |         }
      | ^
answer.code:33:3: error: extended character   is not valid in an identifier
   33 |         }
      |   ^
answer.code:33:5: error: extended character   is not valid in an identifier
   33 |         }
      |     ^
answer.code:33:7: error: extended character   is not valid in an identifier
   33 |         }
      |       ^
answer.code:34:1: error: extended character   is not valid in an identifier
   34 |     }
      | ^
answer.code:34:3: error: extended character   is not valid in an identifier
   34 |     }
      |   ^
answer.code:35:1: error: extended character   is not valid in an identifier
   35 |     int l=n,r=m;
      | ^
answer.code:35:3: error: extended character   is not valid in an identifier
   35 |     int l=n,r=m;
      |   ^
answer.code:36:1: error: extended character   is not valid in an identifier
   36 |     dp[l][r]=0;
      | ^
answer.code:36:3: error: extended character   is not valid in an identifier
   36 |     dp[l][r]=0;
      |   ^
answer.code:37:1: error: extended character  ...