当前位置:网站首页>CSP student queue
CSP student queue
2022-07-06 09:08:00 【< WRM>】
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
int a[N];
int main() {
int n,m;
scanf("%d",&n);
scanf("%d",&m);
for(int i=1;i<=n;i++) {
a[i]=i;
}
for(int i=0;i<m;i++) {
int p,q;
scanf("%d%d",&p,&q);
for(int j=1;j<=n;j++) {
if(a[j]==p) {
if(q>=0) {
for(int k=j;k<j+q;k++) {
a[k]=a[k+1];
}
a[j+q]=p;
break;
}
else {
q=-1*q;
for(int k=j;k>j-q;k--) {
a[k]=a[k-1];
}
a[j-q]=p;
break;
}
}
}
}
for(int i=1;i<=n;i++) {
printf("%d ",a[i]);
}
return 0;
}
边栏推荐
- Leetcode: Sword finger offer 42 Maximum sum of continuous subarrays
- CSP first week of question brushing
- [embedded] cortex m4f DSP Library
- Esp8266-rtos IOT development
- Advanced Computer Network Review(5)——COPE
- LeetCode41——First Missing Positive——hashing in place & swap
- Ijcai2022 collection of papers (continuously updated)
- 在QWidget上实现窗口阻塞
- 【剑指offer】序列化二叉树
- [OC]-<UI入门>--常用控件的学习
猜你喜欢
Cesium draw points, lines, and faces
Selenium+Pytest自动化测试框架实战
Detailed explanation of dynamic planning
【图的三大存储方式】只会用邻接矩阵就out了
opencv+dlib实现给蒙娜丽莎“配”眼镜
Pytest参数化你不知道的一些使用技巧 /你不知道的pytest
LeetCode41——First Missing Positive——hashing in place & swap
一篇文章带你了解-selenium工作原理详解
Alibaba cloud server mining virus solution (practiced)
Different data-driven code executes the same test scenario
随机推荐
[embedded] print log using JLINK RTT
【图的三大存储方式】只会用邻接矩阵就out了
BMINF的後訓練量化實現
【每日一题】搬运工 (DFS / DP)
Improved deep embedded clustering with local structure preservation (Idec)
Advance Computer Network Review(1)——FatTree
Variable length parameter
Advanced Computer Network Review(5)——COPE
BN折叠及其量化
七层网络体系结构
CUDA implementation of self defined convolution attention operator
【shell脚本】使用菜单命令构建在集群内创建文件夹的脚本
The carousel component of ant design calls prev and next methods in TS (typescript) environment
[oc]- < getting started with UI> -- learning common controls
Detailed explanation of dynamic planning
Intel distiller Toolkit - Quantitative implementation 3
[sword finger offer] serialized binary tree
Once you change the test steps, write all the code. Why not try yaml to realize data-driven?
[OC-Foundation框架]-<字符串And日期与时间>
Pytest's collection use case rules and running specified use cases