当前位置:网站首页>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:236. The nearest common ancestor of binary tree
- 注意力机制的一种卷积替代方式
- 【shell脚本】使用菜单命令构建在集群内创建文件夹的脚本
- [oc]- < getting started with UI> -- learning common controls
- Leetcode: Jianzhi offer 03 Duplicate numbers in array
- Selenium+Pytest自动化测试框架实战(下)
- LeetCode:41. Missing first positive number
- 如何正确截取字符串(例:应用报错信息截取入库操作)
- Tdengine biweekly selection of community issues | phase III
- A convolution substitution of attention mechanism
猜你喜欢
[OC-Foundation框架]--<Copy对象复制>
Esp8266-rtos IOT development
Computer graduation design PHP Zhiduo online learning platform
Ijcai2022 collection of papers (continuously updated)
Using C language to complete a simple calculator (function pointer array and callback function)
[OC]-<UI入门>--常用控件的学习
LeetCode:221. 最大正方形
Nacos 的安装与服务的注册
数字人主播618手语带货,便捷2780万名听障人士
[oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
随机推荐
Navicat premium create MySQL create stored procedure
Computer graduation design PHP Zhiduo online learning platform
Leetcode: Jianzhi offer 03 Duplicate numbers in array
Different data-driven code executes the same test scenario
LeetCode:162. 寻找峰值
[embedded] print log using JLINK RTT
pytorch查看张量占用内存大小
[OC-Foundation框架]---【集合数组】
LeetCode41——First Missing Positive——hashing in place & swap
[oc foundation framework] - < copy object copy >
MYSQL卸载方法与安装方法
ant-design的走马灯(Carousel)组件在TS(typescript)环境中调用prev以及next方法
UML图记忆技巧
[sword finger offer] serialized binary tree
To effectively improve the quality of software products, find a third-party software evaluation organization
[text generation] recommended in the collection of papers - Stanford researchers introduce time control methods to make long text generation more smooth
After reading the programmer's story, I can't help covering my chest...
Intel distiller Toolkit - Quantitative implementation 1
Selenium+Pytest自动化测试框架实战
BMINF的後訓練量化實現