#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define mkt make_tuple
#define debug printf
#define all(x) x.begin(),x.end()
#define lp(i,a,b) for(int i = a ; i< b ; i++)
#define ss second
#define ff first
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mk make_pair
using namespace std ;
struct Contestant
{
int score, solved, id ;
Contestant() { score = solved = id = 0 ; }
bool operator < ( Contestant other ) const
{
if( score == other.score && solved == other.solved ) return id < other.id ;
if(score == other.score ) return solved > other.solved ;
return score > other.score ;
}
};
int N , T , P ;
int score_task[2010] , solved[2010][2010 ] ;
Contestant v[2010] ;
int main()
{
scanf("%d%d%d", &N, &T , &P ) ;
lp(i,1,N+1)
{
for(int j = 1 ; j <= T ; j++ )
{
scanf("%d", &solved[i][j] ) ;
v[i].solved += solved[i][j] ;
score_task[j] += !solved[i][j] ;
}
v[i].id = i ;
}
lp(i,1,N+1)
lp(j,1,T+1) v[i].score += solved[i][j] * score_task[j] ;
sort( v+1, v+1+N ) ;
lp(i,1,N+1)
if( v[i].id == P )
printf("%d %d\n" , v[i].score, i ) ;
}
Compilation message
poi.cpp:4:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization ("O3")
poi.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization ("unroll-loops")
poi.cpp: In function 'int main()':
poi.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d", &N, &T , &P ) ;
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:46:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &solved[i][j] ) ;
~~~~~^~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
512 KB |
Output is correct |
6 |
Correct |
5 ms |
640 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
5 ms |
768 KB |
Output is correct |
9 |
Correct |
6 ms |
768 KB |
Output is correct |
10 |
Correct |
8 ms |
1280 KB |
Output is correct |
11 |
Correct |
18 ms |
2304 KB |
Output is correct |
12 |
Correct |
27 ms |
3456 KB |
Output is correct |
13 |
Correct |
68 ms |
6648 KB |
Output is correct |
14 |
Correct |
94 ms |
9208 KB |
Output is correct |
15 |
Correct |
161 ms |
11384 KB |
Output is correct |
16 |
Correct |
175 ms |
12356 KB |
Output is correct |
17 |
Correct |
252 ms |
13632 KB |
Output is correct |
18 |
Correct |
284 ms |
15352 KB |
Output is correct |
19 |
Correct |
371 ms |
17784 KB |
Output is correct |
20 |
Correct |
417 ms |
17656 KB |
Output is correct |