QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#242600#5580. Branch ManagerSpinozaWA 0ms3588kbC++20501b2023-11-07 15:31:332023-11-07 15:31:35

Judging History

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

  • [2023-11-07 15:31:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2023-11-07 15:31:33]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'