Submission #963088

#TimeUsernameProblemLanguageResultExecution timeMemory
963088coolboy19521Poi (IOI09_poi)C++17
100 / 100
372 ms32080 KiB
# include <bits/stdc++.h> namespace ddr { # define bpc(bt) __builtin_popcountll(bt) # define bcl(bt) __builtin_clz(bt) # define alr(v) rbegin(v), rend(v) # define all(v) begin(v), end(v) # define si(v) ((ll)v.size()) # define mp make_pair # define pb push_back # define ins insert # define se second # define fi first template <class T, size_t N> using ar = std::array <T, N>; template <class T, class U> using pi = std::pair <T, U>; template <class T> using pq = std::priority_queue <T>; template <class T> using mt = std::multiset <T>; template <class T> using ve = std::vector <T>; template <class T> using qu = std::queue <T>; typedef std::string str; typedef long long ll; typedef bool bo; typedef char ch; using namespace std; const ll inf = 1e18 + 18; } using namespace ddr; const ll sz = 3e5 + 15; const ll sm = 2e3 + 6; ll n, t, p, i, j; ll c[sm][sm]; int main() { cin.tie(nullptr) -> sync_with_stdio(false); cin >> n >> t >> p; ve <ar <ll, 3>> r; map <ll, ll> cs; for (i = 1; i <= n; i ++) { ll sp = 0; for (j = 1; j <= t; j ++) { cin >> c[i][j]; if (c[i][j]) { cs[j] ++; sp ++; } } r.pb({0, -sp, i}); } for (ar <ll, 3>& k : r) { ll po; po = 0; for (j = 1; j <= t; j ++) { if (c[k[2]][j]) { po += n - cs[j]; } } k[0] = -po; } sort(all(r)); for (i = 0; i < n; i ++) { if (p == r[i][2]) { cout << -r[i][0] << ' ' << 1 + i << '\n'; break; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...