#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
// #define int long long
typedef long long ll;
typedef pair<ll, ll> PII;
const ll N = 3e5 + 10, INF = 1e18, mod = 1e9 + 7;
// double dp[N][2];
struct node
{
string s;
ll num, dist, boo;
} a[N], b[N];
bool operator<(const node &x,const node &y)
{
if (y.num == x.num)
return x.dist < y.dist;
return x.num < y.num;
}
void solve()
{
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
string s;
ll num, dist, boo;
cin >> s >> num >> dist >> boo;
a[i] = {s, num, dist, boo};
}
sort(a + 1, a + 1 + n);
int cnt = 0;
for (int i = 1; i <= n; i++)
{
if (a[i].boo == 0)
continue;
cnt++;
b[cnt] = a[i];
if (cnt == m)
break;
}
cout << cnt << endl;
for (int i = 1; i <= cnt; i++)
{
cout << b[i].s << " " << b[i].num << " " << b[i].dist << " " << b[i].boo << endl;
}
}
signed main()
{
// ios::sync_with_stdio(0);
// // cin.tie(0), cout.tie(0);
// freopen("10.in","r",stdin);
// freopen("10.out","w",stdout);
ll T = 1;
// cin >> T;
while (T--)
solve();
return 0;
}
编程训练营比赛数据.zip
需积分: 0 26 浏览量
2023-06-16
20:20:30
上传
评论
收藏 41.68MB ZIP 举报
zjy000zjy
- 粉丝: 0
- 资源: 1