Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
607 B
0
Indexable
Never
#include <iostream>
#include <vector>

int main() {
	int n = 0;
	int m = 0;
	int tmp = 0;
	int maxValue = 0;
	int maxString = 0;
	int maxColumn = 0;
	std::vector<std::vector<int>> v;
	std::cin >> n >> m;

	for (int i = 0; i < n; i++) {
		v.push_back({});
		for (int j = 0; j < m; j++) {
			std::cin >> tmp;
			v[i].push_back(tmp);
		}
	}
	
	maxValue = v[0][0];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (v[i][j] > maxValue) {
				maxValue = v[i][j];
				maxString = i;
				maxColumn = j;
			}
		}
	}
	std::cout << maxString << ' ' << maxColumn;
}
Leave a Comment