You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

2 years ago
#include <bits/stdc++.h>
using namespace std;
bool judge(const pair<int, int> a, const pair<int, int> b) {
if (a.second != b.second) return a.second > b.second;
else
return a.first < b.first;
}
int main() {
//输入+输出重定向
freopen("../1292.txt", "r", stdin);
int n;
cin >> n;
vector<vector<char>> a(n + 1, vector<char>(n + 1));
vector<pair<int, int>> p;
for (int i = 1; i <= n; i++) {
int sum = 0;
for (int j = 1; j <= n; j++) {
cin >> a[i][j];
if (a[i][j] == 'W')sum += 3;
if (a[i][j] == 'D') sum += 1;
}
p.push_back({i, sum});
}
//按value排序如果value一样按key排序
sort(p.begin(), p.end(), judge);
//输出得分最高
int maxN = p[0].second;
cout << p[0].first << " ";
for (int i = 1; i < n; i++) {
if (p[i].second == maxN) cout << p[i].first << " ";
}
//关闭文件
fclose(stdin);
return 0;
}