QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741147#7990. 广播_LSA_#WA 0ms20856kbC++141.1kb2024-11-13 13:34:452024-11-13 13:34:45

Judging History

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

  • [2024-11-13 13:34:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:20856kb
  • [2024-11-13 13:34:45]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define fi first
#define se second
#define mk make_pair
using namespace std;
ll read(){
    ll X = 0 ,r = 1;
    char ch = getchar();
    while(!isdigit(ch) && ch != '-') ch = getchar();
    if(ch == '-') r = -1,ch = getchar();
    while(isdigit(ch)) X = X*10+ch-'0',ch = getchar();
    return X*r;
}
const int N = 2100;
int n,m;
int a[N],b[N];
int f[N][N];
int main(){
    n = read(); m = read();
    for(int i=1;i<=n;i++) a[i] = read();
    for(int i=1;i<=m;i++) b[i] = read();
    reverse(a+1,a+1+n);
    reverse(b+1,b+1+m);
    int ans = 1e9;
    memset(f,0x3f,sizeof(f));
    f[0][0] = 0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            f[i][j] = min(f[i][j],f[i-1][j]+1);
            f[i][j] = min(f[i][j],f[i][j-1]+1);
            if(a[i] == b[j] || a[i] == 1 || b[j] == 1) f[i][j] = min(f[i][j],f[i-1][j-1]);
            if(i == n || j == m) ans = min(ans,f[i][j]);
        }
    }
    cout << ans;
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 20848kb

input:

4 2
2 1 3 2
4 2

output:

1

result:

ok single line: '1'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 20856kb

input:

1 1
2
3

output:

1000000000

result:

wrong answer 1st lines differ - expected: '1', found: '1000000000'