当前位置:网站首页>Public key box
Public key box
2022-07-06 14:53:00 【< WRM>】
#include<bits/stdc++.h>
using namespace std;
const int N = 10010;
struct node {
int id;
int type;
int time;
} a[N];
int q[N];
bool compare(node x, node y) {
if (x.time != y.time) return x.time < y.time;
if (x.type != y.type) return x.type > y.type;
if (x.id != y.id) return x.id < y.id;
}
int main() {
int n, k;
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++) {
q[i] = i;
}
int pos = 0;
while (k--) {
int id, start, length;
scanf("%d%d%d", &id, &start, &length);
a[pos++] = {
id, 0, start}; // Take the key
a[pos++] = {
id, 1, start + length}; // Change the key
}
sort(a, a + pos,compare);
for (int i = 0; i < pos; i++) {
if (a[i].type == 0) {
for (int j = 1; j <= n; j++) {
if (a[i].id == q[j]) {
q[j] = 0;
break;
}
}
} else {
for (int j = 1; j <= n; j++) {
if (!q[j]) {
q[j] = a[i].id;
break;
}
}
}
}
for(int i=1;i<=n;i++) printf("%d ",q[i]);
return 0;
}
边栏推荐
- Software testing interview summary - common interview questions
- Fundamentals of digital circuits (II) logic algebra
- [HCIA continuous update] advanced features of routing
- C language do while loop classic Level 2 questions
- 数据库多表链接的查询方式
- Numpy Quick Start Guide
- [issue 18] share a Netease go experience
- Function: find the root of the equation by Newton iterative method
- The four connection methods of JDBC are directly coded
- 《統計學》第八版賈俊平第七章知識點總結及課後習題答案
猜你喜欢

《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案

《统计学》第八版贾俊平第三章课后习题及答案总结

数字电路基础(二)逻辑代数

Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class

DVWA exercise 05 file upload file upload

Statistics, 8th Edition, Jia Junping, Chapter VIII, summary of knowledge points of hypothesis test and answers to exercises after class

内网渗透之内网信息收集(三)

数字电路基础(一)数制与码制

Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?

数字电路基础(四) 数据分配器、数据选择器和数值比较器
随机推荐
王爽汇编语言学习详细笔记一:基础知识
线程的实现方式总结
《统计学》第八版贾俊平第一章课后习题及答案总结
“Hello IC World”
Realize applet payment function with applet cloud development (including source code)
Function: string storage in reverse order
What is an index in MySQL? What kinds of indexes are commonly used? Under what circumstances will the index fail?
Soft exam information system project manager_ Project set project portfolio management --- Senior Information System Project Manager of soft exam 025
【指针】求字符串的长度
5 minutes to master machine learning iris logical regression classification
Résumé des points de connaissance et des réponses aux exercices après la classe du chapitre 7 de Jia junping dans la huitième édition des statistiques
函数:求两个正数的最大公约数和最小公倍
Zhejiang University Edition "C language programming experiment and exercise guide (3rd Edition)" topic set
Fundamentals of digital circuits (I) number system and code system
C language do while loop classic Level 2 questions
Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class
函数:求1-1/2+1/3-1/4+1/5-1/6+1/7-…+1/n
函数:字符串反序存放
Statistics 8th Edition Jia Junping Chapter 2 after class exercises and answer summary
数字电路基础(二)逻辑代数