# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1088367 |
2024-09-14T10:03:11 Z |
vjudge1 |
Izbori (COCI17_izbori) |
C++17 |
|
1 ms |
456 KB |
// بسم الله الرحمن الرحيم
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define int long long
#define pb push_back
#define endl '\n'
#define ld long double
#define applejuice ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
const ll mod=1e9+7;
const ll inf=1e18;
const ll mxsz=100+4;
const ld pi=acos(-1.0);
int win[mxsz];//m
vector<int>need;
signed main() {
applejuice;
int n,m,k;
cin>>n>>m>>k;
int a[m];
int pass=0;
for (int i=0;i<n;i++){
pass=0;
for (int j=0;j<m;j++){
cin>>a[j];
if(pass==0)win[a[0]]++;
pass=1;
if (j==m-1) {
for (int l = 0; l < m; l++) {
if (a[l] == k && l!=0) {
need.pb(l);
}
}
}
}
}
/*for(int i=0;i<need.size();i++){
cout<<need[i]<<" ";
}cout<<endl;*/
/*for (int i=0;i<=m;i++){
cout<<win[i]<<" ";
}cout<<endl;*/
int mxn=-1,mxi=0;
for (int i=0;i<=m;i++){
if (win[i]>mxn){
mxn=win[i];
mxi=i;
}
}
//cout<<mxi<<" "<<mxn<<endl;
cout<<mxi<<endl;
if(mxi==k){
cout<<0;
return 0;
}
int ans=0,ned;
if (mxi<k){
ned=(mxn+1)/2;
//cout<<ned<<endl;
sort(need.begin(),need.end());
//cout<<need[0]<<endl;
for (int i=0;i<ned;i++){
ans+=need[i];
}
}else{
ned=mxn/2;
//cout<<ned<<endl;
sort(need.begin(),need.end());
for (int i=0;i<ned;i++){
ans+=need[i];
}
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
348 KB |
Partially correct |
2 |
Partially correct |
0 ms |
348 KB |
Partially correct |
3 |
Partially correct |
0 ms |
348 KB |
Partially correct |
4 |
Partially correct |
0 ms |
348 KB |
Partially correct |
5 |
Partially correct |
0 ms |
344 KB |
Partially correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Partially correct |
0 ms |
348 KB |
Partially correct |
8 |
Partially correct |
0 ms |
348 KB |
Partially correct |
9 |
Partially correct |
0 ms |
348 KB |
Partially correct |
10 |
Partially correct |
0 ms |
344 KB |
Partially correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Partially correct |
0 ms |
456 KB |
Partially correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Partially correct |
0 ms |
348 KB |
Partially correct |
15 |
Partially correct |
0 ms |
348 KB |
Partially correct |
16 |
Partially correct |
0 ms |
344 KB |
Partially correct |
17 |
Partially correct |
1 ms |
348 KB |
Partially correct |
18 |
Partially correct |
1 ms |
344 KB |
Partially correct |
19 |
Partially correct |
0 ms |
348 KB |
Partially correct |
20 |
Partially correct |
0 ms |
348 KB |
Partially correct |