# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
732972 |
2023-04-29T22:51:08 Z |
Roman70 |
Poi (IOI09_poi) |
C++17 |
|
217 ms |
27068 KB |
#include "bits/stdc++.h"
#define forn(i,n) for(int i = 0;i<n;i++)
#define ll long long
#define pb push_back
#define sz(a) a.size()
using namespace std;
struct player{
int points = 0;
int p =0;
vector<int>t;
int id;
};
bool cmp(player a, player b){
if(a.points > b.points || a.points == b.points && a.p > b.p || a.points == b.points && a.p > b.p && a.id > b.id );
}
void solve()
{
int n,p,m;
cin >> n >> p >> m;
player pl[n];
int puncte[p];
memset(puncte,0,sizeof(puncte));
forn(i,n){
pl[i].id = i;
forn(j,p){
int t;
cin >> t;
if(t) {pl[i].t.push_back(j);}
else puncte[j]++;
}
}
forn(i,n){
pl[i].p = pl[i].t.size();
for(auto prob : pl[i].t)
pl[i].points += puncte[prob];
}
sort(pl,pl+n,cmp);
forn(i,n) {
if(pl[i].id == p){
cout<<pl[i].points<<" "<<i+1<<"\n";
break;
}
}
}
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// cout << 4;
int t = 1;
// cin >> t;
while(t--) solve();
return 0;
}
Compilation message
poi.cpp: In function 'bool cmp(player, player)':
poi.cpp:19:52: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
19 | if(a.points > b.points || a.points == b.points && a.p > b.p || a.points == b.points && a.p > b.p && a.id > b.id );
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
poi.cpp:19:102: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
19 | if(a.points > b.points || a.points == b.points && a.p > b.p || a.points == b.points && a.p > b.p && a.id > b.id );
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
poi.cpp:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
20 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
2 |
Runtime error |
1 ms |
448 KB |
Execution killed with signal 11 |
3 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 11 |
4 |
Runtime error |
1 ms |
440 KB |
Execution killed with signal 11 |
5 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
6 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
7 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 11 |
8 |
Runtime error |
2 ms |
452 KB |
Execution killed with signal 11 |
9 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 11 |
10 |
Runtime error |
3 ms |
716 KB |
Execution killed with signal 11 |
11 |
Runtime error |
8 ms |
1236 KB |
Execution killed with signal 11 |
12 |
Runtime error |
13 ms |
1872 KB |
Execution killed with signal 11 |
13 |
Runtime error |
35 ms |
4440 KB |
Execution killed with signal 11 |
14 |
Runtime error |
47 ms |
6196 KB |
Execution killed with signal 11 |
15 |
Runtime error |
85 ms |
13296 KB |
Execution killed with signal 11 |
16 |
Runtime error |
97 ms |
14292 KB |
Execution killed with signal 11 |
17 |
Runtime error |
142 ms |
17484 KB |
Execution killed with signal 11 |
18 |
Runtime error |
152 ms |
19696 KB |
Execution killed with signal 11 |
19 |
Runtime error |
194 ms |
23920 KB |
Execution killed with signal 11 |
20 |
Runtime error |
217 ms |
27068 KB |
Execution killed with signal 11 |