# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
281763 |
2020-08-23T12:39:53 Z |
Revo7 |
Hokej (COCI17_hokej) |
C++14 |
|
235 ms |
40760 KB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define left 2*i+1
#define righ 2*i+2
#define mid (l+r)/2
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const ll maxn=5e5+100;
const ll mod=1e9+9;
const ll base=27;
ll n,m;
struct player{
ll val,cnt,id;
};
vector<player>a;
bool com(player a,player b){
if(a.val==b.val){
if(a.cnt==b.cnt)return a.id>b.id;
return a.cnt<b.cnt;
}
return a.val<b.val;
}
ll pl[6][maxn];
struct sub{
ll tim,x,y;
};
bool cmp(sub a,sub b){
return a.tim<b.tim;
}
vector<sub>s;
int main()
{
//setIO("threesum");
IOS
cin>>m>>n;
a.resize(n);
for(ll i=0;i<n;i++){
cin>>a[i].val>>a[i].cnt;
a[i].id=i+1;
}
sort(a.begin(),a.end(),com);
ll tot=0;
for(int i=0;i<6&&a.size();i++){
for(int j=0;j<m;j++){
if(!a.size())break;
int x=a.size()-1;
tot+=a[x].val;
a[x].cnt--;
if(!a[x].cnt)a.pop_back();
pl[i][j]=a[x].id;
}
}
cout<<tot<<endl;
for(int i=0;i<6;i++){
cout<<pl[i][0]<<' ';
}
cout<<endl;
for(int i=0;i<6;i++){
for(int j=1;j<m;j++){
if(pl[i][j]!=pl[i][j-1]&&pl[i][j]>0){
s.pb({j,pl[i][j-1],pl[i][j]});
}
}
}
sort(s.begin(),s.end(),cmp);
cout<<s.size()<<endl;
for(auto it:s)cout<<it.tim<<' '<<it.x<<' '<<it.y<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
768 KB |
Output is correct |
3 |
Correct |
33 ms |
24696 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
16 ms |
10240 KB |
Output is correct |
6 |
Correct |
4 ms |
640 KB |
Output is correct |
7 |
Incorrect |
4 ms |
768 KB |
Output isn't correct |
8 |
Incorrect |
54 ms |
5584 KB |
Output isn't correct |
9 |
Incorrect |
227 ms |
40760 KB |
Output isn't correct |
10 |
Incorrect |
235 ms |
40760 KB |
Output isn't correct |