제출 #9079

#제출 시각아이디문제언어결과실행 시간메모리
9079levant916Penalty calculation (kriii2_PE)C++98
0 / 4
0 ms1676 KiB
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

typedef pair<int, int> PAIR;

bool cmp(PAIR a, PAIR b) {
	return a.second > b.second;
}
int stamp[301];
int main(void) {

	int T;
	vector<PAIR> set;
	cin >> T;
	for (int i = 0; i < T; i++) {
		int t, s;
		cin >> t >> s;
		stamp[t] = i + 1;
		set.push_back(PAIR(t, s));
	}
	sort(set.begin(), set.end(), cmp);

	int tf = set[0].first;
	int sf = set[0].second;
	int p ;

	if (sf == 0) {
		p = 0;
	}
	else if (sf == 1 || sf == 4) {
		p = tf + (stamp[tf] - 1) * 20;
	}
	cout << p << endl;

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...