Submission #9079

# Submission time Handle Problem Language Result Execution time Memory
9079 2014-09-27T11:26:09 Z levant916 Penalty calculation (kriii2_PE) C++
0 / 4
0 ms 1676 KB
#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 time Memory Grader output
1 Correct 0 ms 1676 KB Output is correct
2 Correct 0 ms 1676 KB Output is correct
3 Correct 0 ms 1676 KB Output is correct
4 Incorrect 0 ms 1676 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -