문제

#include <string>
#include <vector>
using namespace std;

string solution(vector<vector<int>> scores) {
	string answer = "";
	int size = scores.size(), cnt, sum, minCnt, maxCnt, avg, i, j;

	for (j = 0; j < size; j++) {
		cnt = size, sum = 0, minCnt = 0, maxCnt = 0;
		for (i = 0; i < size; i++) {
			sum += scores[i][j];
			if (scores[i][j] > scores[j][j]) maxCnt++;
			if (scores[i][j] < scores[j][j]) minCnt++;
		}

		if (maxCnt == size - 1 || minCnt == size - 1) {
			sum -= scores[j][j];
			cnt--;
		}

		avg = sum / cnt;
		if (avg >= 90) answer += "A";
		else if (avg >= 80) answer += "B";
		else if (avg >= 70) answer += "C";
		else if (avg >= 50) answer += "D";
		else answer += "F";
	}

	return answer;
}