当前位置: 首页 > 网络知识

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

时间:2026-01-29 09:38:09

传送门

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; }

  



上一篇:[luoguP1033] 自由落体(模拟?)
下一篇:[luoguP1076] 寻宝(模拟)
stl 模拟
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器
  • 英特尔第五代 Xeon CPU 来了:详细信息和行业反应
  • 由于云计算放缓引发扩张担忧,甲骨文股价暴跌
  • Web开发状况报告详细介绍可组合架构的优点
  • 如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳
  • 美光在数据中心需求增长后给出了强有力的预测
  • 2027服务器市场价值将接近1960亿美元
  • 生成式人工智能的下一步是什么?
  • 分享在外部存储上安装Ubuntu的5种方法技巧
  • 全球数据中心发展的关键考虑因素
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器

    英特尔第五代 Xeon CPU 来了:详细信息和行业反应

    由于云计算放缓引发扩张担忧,甲骨文股价暴跌

    Web开发状况报告详细介绍可组合架构的优点

    如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳

    美光在数据中心需求增长后给出了强有力的预测

    2027服务器市场价值将接近1960亿美元

    生成式人工智能的下一步是什么?

    分享在外部存储上安装Ubuntu的5种方法技巧

    全球数据中心发展的关键考虑因素