Submission #1190100

#TimeUsernameProblemLanguageResultExecution timeMemory
1190100tullPoi (IOI09_poi)C++20
45 / 100
161 ms31804 KiB
// #include <iostream>
// #include <vector>
// #include <queue>
// #include <stack>
// #include <algorithm>
// #include <string.h>
// #include <math.h>
// #include <map>
// #include <tuple>
 #include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/
#define int long long
#define ll long long
using pil = pair<int, long long>;
using pli = pair<long long, int>;
using pll = pair<long long, long long>;
using pii = pair<int, int>;
using piii = pair<pair<int, int>, int>;
using plll = pair<pair<ll, ll>, ll>;
using pic = pair<int, char>;
const int MX = 1000000000000000000LL; // 1e18
const int MN = -MX;                   //-1e18
const int MOD = 1e9 + 7;
#define bp '\n'
#define ull unsigned long long
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define inv(a)          \
      for (auto &e : a) \
      {                 \
            cin >> e;   \
      }
#define vp cout << '\n';
#define inv2dm(a)             \
      for (auto &e : a)       \
            for (auto &c : e) \
                  cin >> c;
#define ck(a)                 \
      for (auto &e : a)       \
            cout << e << ' '; \
      cout << '\n';
#define ckpf(a)               \
      for (auto &e : a)       \
            printf("%d ", e); \
      printf("\n");
#define ckpair(a)                                  \
      for (auto &[f, s] : a)                       \
            cout << "(" << f << ", " << s << ") "; \
      cout << '\n';
#define LMX LLONG_MAX
#define LMN LLONG_MIN
#define ck2dm(a)                                                 \
      cout << '\n';                                              \
      for (auto &e : a)                                          \
      {                                                          \
            for (auto &c : e)                                    \
                  cout << ((c == MX or c == MN) ? 9 : c) << ' '; \
            cout << '\n';                                        \
      }
#define ck2dmlr(a, l, r)                                                            \
      cout << '\n';                                                                 \
      for (int i = 0; i < l; ++i)                                                   \
      {                                                                             \
            for (int j = 0; j < r; ++j)                                             \
            {                                                                       \
                  cout << ((a[i][j] == MN or a[i][j] == MX) ? 9 : a[i][j]) << '\t'; \
            }                                                                       \
            cout << '\n';                                                           \
      }
#define tostr(a) to_string(a)
#define qs(a)                            \
      for (int i = 1; i < a.size(); ++i) \
            a[i] += a[i - 1];
#define vpii vector<pair<int, int>>
#define dir vector<pair<int, int>> direct = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
#define val(i, j) (i >= 0 and i < n and j >= 0 and j < m) ? 1 : 0
#define vi vector<int>
#define mt make_tuple
#define mp make_pair
#define db double


signed main()
{
      cin.tie(nullptr)->sync_with_stdio(false);
      int n,m,k;
      cin>>n>>m>>k;
      vector<int>prob(n,0);
      int a[n][m];
      //map<int,pair<int,int>>part;
      vector<tuple<int,int,int>>rank(n);
      for(int i=0;i<n;++i){
            for(int j=0;j<m;++j){
                  cin>>a[i][j];
                  if(a[i][j]==0){
                        ++prob[j];
                  }
            }
      }
      for(int i=0;i<n;++i){
            int cnt=0,s=0;
            for(int j=0;j<m;++j){
                  if(a[i][j]==1){
                        ++cnt;
                        s+=prob[j];
                  }
            }
            rank[i]=mt(s,cnt,i);

      }
      auto [f, s, l] = rank[k - 1];
      cout<<f;
      //vp ckpair(rank);
      sort(all(rank),[&](const tuple<int,int,int>&l,const tuple<int,int,int>&r){
            if(get<0>(l)==get<0>(r)){
                  if(get<1>(l)==get<1>(r)){
                        return get<2>(l)<get<2>(r);
                  }
                  return get<1>(l) < get<1>(r);
            }
            return get<0>(l)>get<0>(r);
      });
      for(int i=0;i<n;++i){
            if(mt(f,s,l)==rank[i]){
                  cout<<' '<<i+1;
                  break;
            }
      }
      /*vp for(int i=0;i<n;++i){
            auto [f,s,l]=rank[i];
            cout<<f<<' '<<s<<' '<<l<<bp;
      }*/
      //vp ckpair(rank);
      //vp ck(prob)
      return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...