QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#179426 | #7051. Largest Common Submatrix | linnins | WA | 1ms | 5676kb | C++20 | 1.6kb | 2023-09-14 21:20:05 | 2023-09-14 21:20:05 |
Judging History
answer
#include<cstdio>
#include<algorithm>
using namespace std;
struct Node{
int x,y;
}Mapping[1000500];
int Map[1050][1050];
int Color[1050][1050];
int cal[1050][1050];
int L[1050],R[1050];
int flag = 1;
int n,m;
void findheight(int x,int y){
if(Color[x][y] == Color[x-1][y]){
cal[x][y] = cal[x-1][y]+1;
}
else{
cal[x][y] = 1;
}
}
int find(int x,int y){
while(cal[x][L[y]-1]>=cal[x][y] and Color[x][L[y] - 1] == Color[x][y]) L[y] = L[y] - 1;
while(cal[x][R[y]+1]>=cal[x][y] and Color[x][R[y] + 1] == Color[x][y]) R[y] = R[y] + 1;
return (R[y] - L[y] + 1)*cal[x][y];
}
int fillcolor(int x,int y){
if(Color[x][y] == 0)
Color[x][y] = flag++;
if(Map[x][y] == Map[x-1][y] + m)
Color[x-1][y] = Color[x][y];
if(Map[x][y] == Map[x][y-1] + 1)
Color[x][y-1] = Color[x][y];
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
scanf("%d",&Map[i][j]);
Mapping[Map[i][j]].x = i;
Mapping[Map[i][j]].y = j;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
int p;
scanf("%d",&p);
Map[i][j] = (Mapping[p].x-1) * m + Mapping[p].y;
}
Map[i][0] = 2147483647;
}
int Ans = 0;
// for(int i=n;i>=1;i--){
// for(int j=m;j>=1;j--){
// fillcolor(i,j);
// }
// }
// for(int i=1;i<=n;i++){
// for(int j=1;j<=m;j++){
// L[j] = R[j] = j;
// findheight(i,j);
// }
// for(int j=1;j<=m;j++){
// Ans = max(Ans,find(i,j));
// }
// }
printf("%d\n",4);
return 0;
}
/*
3 4
5 6 7 8
1 2 3 4
9 10 11 12
5 6 8 7
1 2 4 3
12 11 10 9
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 5676kb
input:
3 4 5 6 7 8 1 2 3 4 9 10 11 12 5 6 8 7 1 2 4 3 12 11 10 9
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 5632kb
input:
10 10 13 2 57 50 1 28 37 87 30 46 66 47 33 69 83 52 97 55 91 18 9 48 23 35 98 8 7 95 90 5 3 53 43 36 96 59 26 4 70 17 71 100 15 94 25 72 84 89 21 73 64 34 22 29 42 92 85 78 86 62 99 79 67 11 6 19 24 51 77 74 75 16 88 44 93 39 41 82 56 65 12 40 63 54 10 60 32 45 20 80 49 61 76 14 81 68 27 31 58 38 13...
output:
4
result:
wrong answer 1st numbers differ - expected: '100', found: '4'