[luoguP1056] 排座椅(sort + 模拟)


传送门

nc题,一直sort就过了

代码

#include <cstdio> #include <iostream> #include <algorithm> #define N 2001 #define min(x, y) ((x) < (y) ? (x) : (y)) int n, m, k, l, d; struct node p1[N], p2[N]; inline int read() inline bool cmp(node x, node y) inline bool cmp1(node x, node y) int main() std::sort(p1 + 1, p1 + n, cmp); std::sort(p1 + 1, p1 + k + 1, cmp1); for(i = 1; i <= k; i++) printf("%d ", p1[i].id); puts(""); std::sort(p2 + 1, p2 + m, cmp); std::sort(p2 + 1, p2 + l + 1, cmp1); for(i = 1; i <= l; i++) printf("%d ", p2[i].id); puts(""); return 0; }

  



上一篇:[luoguP3146] [USACO16OPEN]248(区间DP)

下一篇:[luoguP1220] 关路灯(DP)


stl 模拟
Copyright © 2002-2019 k262电脑网 www.k262.cn 皖ICP备2020016292号
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!QQ:251442993 热门搜索 网站地图