Rezultati

Up. imeNalogaJezikRezultatČas oddaje
finalsolution-2018 Plezalne smeri C++ 100/100OK 13. okt '18 @ 10:53

Test Točke Porabljen spomin Porabljen čas Status
#1 50/50 3,215 MiB 0,001 s OK
#2 50/50 3,215 MiB 0,000 s OK

Ocenjevani program (plezalne.cpp):
#include <string>
#include <iostream>
#include <set>

static std::set<std::pair<int, std::string>> rows;

static int test_n(std::string num, std::string totest, int val) {
    if (num == totest) return val + 1;
    if (num == totest + "-") return val;
    if (num == totest + "+") return val + 2;
    return 0;
}

int main() {
    int n = 0;
    std::cin >> n;
    while ((n--) > 0) {
        std::string name;
        std::string number;
        std::cin >> name;
        std::cin >> number;
        int h = 0;
        h += test_n(number, "I", 0);
        h += test_n(number, "II", 3);
        h += test_n(number, "III", 6);
        h += test_n(number, "IV", 9);
        h += test_n(number, "V", 12);
        h += test_n(number, "VI", 15);
        h += test_n(number, "VII", 18);
        h += test_n(number, "VIII", 21);
        h += test_n(number, "IX", 24);
        h += test_n(number, "X", 27);
        h += test_n(number, "XI", 30);
        h += test_n(number, "XII", 33);
        rows.insert(std::make_pair(h, name));
    }
    for (auto it = rows.begin(), end = rows.end(); it != end; it++) {
        std::cout << it->second << std::endl;
    }
    return 0;
}