# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
484441 |
2021-11-03T12:03:58 Z |
PoPularPlusPlus |
Poi (IOI09_poi) |
C++17 |
|
236 ms |
23744 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
#define all(x) x.begin(),x.end()
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
bool remender(ll a , ll b){return a%b;}
bool cmp(pair<int,pair<int,int>> x , pair<int,pair<int,int>> y){
if(x.vf != y.vf)return x.vf > y.vf;
if(x.vs.vf != y.vs.vf)return x.vs.vf > y.vs.vf;
return x.vs.vs < y.vs.vs;
}
void solve(){
int n,t,p;
cin >> n >> t >> p;
p--;
int arr[n][t];
int c[n] , cnt[t];
memset(c,0,sizeof c);
memset(cnt,0,sizeof cnt);
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++){
cin >> arr[i][j];
if(arr[i][j] == 1)c[i]++,cnt[j]++;
}
}
vector<pair<int,pair<int,int>>> v;
for(int i = 0; i < n; i++){
int points = 0;
for(int j = 0; j < t; j++){
if(arr[i][j] == 1){
points += n - cnt[j];
}
}
v.pb(mp(points , mp(c[i] , i)));
}
sort(all(v) , cmp);
int a,b;
for(int i = 0; i < n; i++){
if(v[i].vs.vs == p){
a = v[i].vf;
b = i + 1;
}
}
cout << a << ' ' << b << '\n';
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//int t;cin >> t;while(t--)
solve();
return 0;
}
Compilation message
poi.cpp: In function 'void solve()':
poi.cpp:56:15: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
56 | cout << a << ' ' << b << '\n';
| ^~~
poi.cpp:56:27: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
56 | cout << a << ' ' << b << '\n';
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
2 ms |
324 KB |
Output is correct |
10 |
Correct |
2 ms |
488 KB |
Output is correct |
11 |
Correct |
7 ms |
1016 KB |
Output is correct |
12 |
Correct |
11 ms |
1484 KB |
Output is correct |
13 |
Correct |
33 ms |
3768 KB |
Output is correct |
14 |
Correct |
48 ms |
5188 KB |
Output is correct |
15 |
Correct |
82 ms |
9092 KB |
Output is correct |
16 |
Correct |
122 ms |
9852 KB |
Output is correct |
17 |
Correct |
139 ms |
14392 KB |
Output is correct |
18 |
Correct |
148 ms |
16188 KB |
Output is correct |
19 |
Correct |
198 ms |
21432 KB |
Output is correct |
20 |
Correct |
236 ms |
23744 KB |
Output is correct |