Submission #629903

# Submission time Handle Problem Language Result Execution time Memory
629903 2022-08-15T10:43:49 Z chinmoy_101 Poi (IOI09_poi) C++14
5 / 100
519 ms 680 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool cmp(pair<int, pair<int, int>>a, pair<int, pair<int, int>>b)
{
    if(a.second.second!=b.second.second)
    {
        return a.second.second>b.second.second;
    }
    else
    {
        if(a.second.first!=b.second.first)
        {
            return a.second.first>b.second.first;
        }
        else
        {
            return a.first<b.first;
        }
    }
}   
int main()
{
    int n, t, p;
    cin>>n >>t >>p;
    vector<int> points_for_each_task_array(t, 0);
    vector<vector<int> > arr(n, {0, 0});
    vector<pair<int, pair<int, int>> > final_standing(n, {0, {0, 0}});
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<t; j++)
        {
            cin>>arr[i][j];
            if(arr[i][j]==0)
            {
                points_for_each_task_array[j]++;
            }
        }
    }
    for(int i=0; i<n; i++)
    {
        int ans=0, no_of_problems_solved=0;
        for(int j=0; j<t; j++)
        {
            if(arr[i][j]==1)
            {
                ans+=points_for_each_task_array[j];
                no_of_problems_solved++;
            }
        }
        //id   no.ofproblems solved, ans
        final_standing[i]={i+1, {no_of_problems_solved, ans} };
    }
    sort(final_standing.begin(), final_standing.end(), cmp);
    for(int i=0; i<final_standing.size(); i++)
    {
        if(final_standing[i].first==p)
        {
            cout<<final_standing[i].second.second <<" " <<i+1;
        }
    }
    return 0;
}

Compilation message

poi.cpp: In function 'int main()':
poi.cpp:55:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for(int i=0; i<final_standing.size(); i++)
      |                  ~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 340 KB Execution killed with signal 6
3 Runtime error 1 ms 340 KB Execution killed with signal 6
4 Runtime error 1 ms 340 KB Execution killed with signal 6
5 Runtime error 1 ms 340 KB Execution killed with signal 6
6 Runtime error 1 ms 468 KB Execution killed with signal 6
7 Runtime error 1 ms 340 KB Execution killed with signal 6
8 Runtime error 2 ms 340 KB Execution killed with signal 6
9 Runtime error 3 ms 468 KB Execution killed with signal 6
10 Runtime error 7 ms 468 KB Execution killed with signal 6
11 Runtime error 21 ms 444 KB Execution killed with signal 6
12 Runtime error 26 ms 460 KB Execution killed with signal 6
13 Runtime error 82 ms 464 KB Execution killed with signal 6
14 Runtime error 111 ms 468 KB Execution killed with signal 6
15 Runtime error 194 ms 492 KB Execution killed with signal 6
16 Runtime error 219 ms 496 KB Execution killed with signal 6
17 Runtime error 321 ms 524 KB Execution killed with signal 6
18 Runtime error 359 ms 656 KB Execution killed with signal 6
19 Runtime error 468 ms 680 KB Execution killed with signal 6
20 Runtime error 519 ms 668 KB Execution killed with signal 6