| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 479273 | Spartan117 | Poi (IOI09_poi) | C++14 | 921 ms | 24388 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
struct contestant
{
    vector<int> responses;
    int id;
    int numOfQuestions;
    int score;
    contestant(const int &i)
    {
        id = i;
        numOfQuestions = 0;
        score = 0;
    }
};
vector<contestant> contestants;
map<int, int> marksperTask;
int n{}, t{}, p{};
void inputContestants()
{
    cin >> n >> t >>p;
    int response{};
    for(int i{}; i<n; i++)
    {
        contestants.push_back(contestant(i+1));
        for(int j{}; j<t; j++)
        {
            cin >> response;
            contestants[i].responses.push_back(response);
            if(response==0)
                marksperTask[j+1]++;
        }
        int qnums{};
        for(int response: contestants[i].responses)
            qnums+=response;
        contestants[i].numOfQuestions = qnums;
    }
    
    for(int i{}; i<n; i++)
    {
        for(int j{}; j<t; j++)
            if (contestants[i].responses[j]==1)
                contestants[i].score += marksperTask[j+1];
    }
}
bool compareContestants(contestant &contestant1, contestant &contestant2)
{
    if (contestant1.score > contestant2.score)
        return true;
    else if (contestant1.score == contestant2.score)
    {
        if (contestant1.numOfQuestions > contestant2.numOfQuestions)
            return true;
        else if (contestant1.numOfQuestions == contestant2.numOfQuestions)
            return (contestant1.id < contestant2.id);
        else
            return false;
    }
    else
        return false;
}
void displayOutput()
{
    
    int pScore{}, pRank{};
    for (int i{}; i<n; i++)
        if (contestants[i].id == p)
        {
            pRank = i+1;
            pScore = contestants[i].score;
            break;
        }
    cout << pScore << ' ' << pRank << '\n';
}
int main()
{
    inputContestants();
    sort(contestants.begin(), contestants.end(), compareContestants);
    displayOutput();
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
