文章

13

粉丝

120

获赞

4

访问

11.3k

头像
成绩排序 题解:
P1151 清华大学上机题
发布于2023年5月5日 11:22
阅读数 852

注意事项:

1. 多组输入,需要清空数组,此处使用的node每次重新输入都会覆盖,所以不需要清空

2. 稳定排序,保持原有的顺序使用stable_sort

AC代码

#include <bits/stdc++.h>


#define fi first
#define endl '\n'
#define se second
#define pp pop_back
#define pb push_back
#define lowbit(x) ((x)&(-(x)))
#define all(a) begin(a),end(a)
#define lp(i,j,k) for(int i=int(j);i<=int(k);i++)
#define rlp(i,j,k) for(int i=int(j);i>=int(k);i--)
#define IO std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);

using namespace std;
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template <class T> inline void chkmax(T &x,T y) {if(x<y) x=y;}
template <class T> inline void chkmin(T &x,T y) {if(x>y) x=y;}

const ll mod = 1e9 + 7;
const int N = 1e6 + 10;
const int TN = 1e3 + 10;
const int INF = 0x3f3f3f3f;
int dx[8] = {0,1,0,-1,1,-1,-1,1};
int dy[8] = {1,0,-1,0,1,-1,1,-1};
int a[N],b[N],f[N];
int A[TN][TN],B[TN][TN],dp[T...
登录查看完整内容


登录后发布评论

暂无评论,来抢沙发