Submission #739261

# Submission time Handle Problem Language Result Execution time Memory
739261 2023-05-10T09:13:23 Z Unforgettablepl Poi (IOI09_poi) C++17
100 / 100
268 ms 25508 KB
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;

bool compa(vector<ll> &a, vector<ll> &b){
    if(a[0]==b[0]){
        if(a[1]==b[1]){
            return a[2]<b[2];
        } else {
            return a[1]>b[1];
        }
    } else {
        return a[0]>b[0];
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("measurement.in","r",stdin);
//    freopen("measurement.out","w",stdout);
    ll n,t,p;
    cin >> n >> t >> p;
    p--;
    vector<ll> marks(t,0);
    vector<vector<ll>> scores(n,vector<ll>(3));
    vector<vector<ll>> solved(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < t; j++) {
            int a;
            cin >> a;
            if(a){
                solved[i].emplace_back(j);
            } else {
                marks[j]++;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        scores[i][2] = i;
        scores[i][1] = solved[i].size();
        scores[i][0] = 0;
        for (auto &j: solved[i]) {
            scores[i][0]+=marks[j];
        }
    }
    sort(all(scores),compa);
    for (int i = 0; i < n; i++) {
        if(scores[i][2]==p){
            cout << scores[i][0] << ' ' << i+1;
            return 0;
        }
    }
}

Compilation message

poi.cpp: In function 'int main()':
poi.cpp:41:23: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   41 |     for (int i = 0; i < n; i++) {
      |                     ~~^~~
poi.cpp:42:27: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   42 |         for (int j = 0; j < t; j++) {
      |                         ~~^~~
poi.cpp:52:23: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   52 |     for (int i = 0; i < n; i++) {
      |                     ~~^~~
poi.cpp:61:23: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   61 |     for (int i = 0; i < n; i++) {
      |                     ~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 4 ms 596 KB Output is correct
11 Correct 8 ms 1080 KB Output is correct
12 Correct 13 ms 1712 KB Output is correct
13 Correct 39 ms 4324 KB Output is correct
14 Correct 49 ms 5980 KB Output is correct
15 Correct 91 ms 12892 KB Output is correct
16 Correct 121 ms 13988 KB Output is correct
17 Correct 137 ms 17080 KB Output is correct
18 Correct 196 ms 19344 KB Output is correct
19 Correct 214 ms 23604 KB Output is correct
20 Correct 268 ms 25508 KB Output is correct