QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#242600 | #5580. Branch Manager | Spinoza | WA | 0ms | 3588kb | C++20 | 501b | 2023-11-07 15:31:33 | 2023-11-07 15:31:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;cin>>n>>m;
vector<vector<int>> g(n+1,vector<int>(m+1));
for (int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>g[i][j];
int ans=1e9;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++){
int ansnow=0;
for (int a=1;a<=n;a++)
for (int b=1;b<=m;b++)
if (a!=i||b!=j)
ansnow+=g[a][b]*(abs(a-i)+abs(b-j));
ans=min(ansnow,ans);
}
cout<<ans;
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3588kb
input:
8 5 1 2 4 8 4 6 1 4 2 5 4 7 2 3 5 2 6 4 8
output:
167
result:
wrong answer 1st lines differ - expected: '5', found: '167'