제출 #1209167

#제출 시각아이디문제언어결과실행 시간메모리
1209167basaPoi (IOI09_poi)C++20
45 / 100
101 ms4608 KiB
#include "bits/stdc++.h" #include <iomanip> using namespace std; #define int long long #define ld long double signed main() { cin.tie(0) -> sync_with_stdio(0); int n, t, p; cin >> n >> t >> p; int w[t] = {}; char s[n][t]; array<int, 3>scrs[n]; for(int i = 0; i < n; i++){ for(int j = 0; j < t; j++) cin >> s[i][j]; int cnt = 0; for(int c = 0; c < t; c++){ if(s[i][c] == '1'){ cnt++; w[c]++; } } scrs[i] = {0, -1 * cnt, 0}; if(i == p - 1) scrs[i][2] = 1; } for(int i = 0; i < n; i++){ for(int j = 0; j < t; j++) scrs[i][0] += (s[i][j] == '1' ? n - w[j] : 0); } sort(scrs, scrs + n); reverse(scrs, scrs + n); for(int i = 0; i < n; i++){ if(scrs[i][2] == 1) return cout << scrs[i][0] << ' ' << i + 1, 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...