//ASSLEMA :)
#include <bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
typedef long long ll;
typedef double db;
typedef long double ldb;
//#define int ll //..................................................................
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<db> vdb;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define endl '\n'
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
void IO() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b){
if(a.fi.fi>b.fi.fi)return false;
else{
if(a.fi.fi==b.fi.fi){
if(a.fi.se>b.fi.se) return false;
else if(a.fi.se==b.fi.se){
if(a.se>b.se)return false;
}
else return true;
}
else return true;
}
}
int32_t main(){
boost; IO();
int n, t, p;
cin>>n>>t>>p;
vector<vi> input(n);
for(int i=0; i<n; i++){
vi temp;
for(int j=0; j<t; j++){
int x; cin>>x;
temp.pb(x);
}
input[i]=temp;
}
vi scores(t);
scores.assign(t, n);
for(int i=0; i<t; i++){
for(int j=0; j<n; j++){
if(input[j][i]==1){
scores[i]--;
}
}
}
vector<pair<pi, int>> board;//score, nb_poblems, ' ' , ID
for(int i=0; i<n; i++){
int sc=0, nb=0;
for(int j=0; j<t; j++){
if(input[i][j]==1){
sc+=scores[j];
nb++;
}
}
board.pb(mp(mp(sc, nb), i+1));
}
sort(all(board), cmp);
for(int i=0; i<n; i++){
if(board[i].se==p){
cout<<board[i].fi.fi<<' '<<i+1;
break;
}
}
return 0;
}
Compilation message
poi.cpp: In function 'bool cmp(std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>)':
poi.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
51 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
400 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
492 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
492 KB |
Output isn't correct |
11 |
Incorrect |
11 ms |
1004 KB |
Output isn't correct |
12 |
Incorrect |
18 ms |
1516 KB |
Output isn't correct |
13 |
Incorrect |
51 ms |
3820 KB |
Output isn't correct |
14 |
Incorrect |
72 ms |
5356 KB |
Output isn't correct |
15 |
Incorrect |
130 ms |
9196 KB |
Output isn't correct |
16 |
Incorrect |
139 ms |
10092 KB |
Output isn't correct |
17 |
Incorrect |
209 ms |
14592 KB |
Output isn't correct |
18 |
Incorrect |
240 ms |
16364 KB |
Output isn't correct |
19 |
Incorrect |
315 ms |
20716 KB |
Output isn't correct |
20 |
Incorrect |
357 ms |
21996 KB |
Output isn't correct |