CodeForces 669C Little Artem and Matrix GNU
模拟。
把操作记录一下,倒着复原回去。
- #pragma comment(linker, "/STACK:1024000000,1024000000")
- #include<cstdio>
- #include<cstring>
- #include<cmath>
- #include<algorithm>
- #include<vector>
- #include<map>
- #include<set>
- #include<queue>
- #include<stack>
- #include<iostream>
- using namespace std;
- typedef long long LL;
- const double pi=acos(-1.0),eps=1e-;
- void File()
- {
- freopen("D:\\in.txt","r",stdin);
- freopen("D:\\out.txt","w",stdout);
- }
- template <class T>
- inline void read(T &x)
- {
- char c=getchar(); x=;
- while(!isdigit(c)) c=getchar();
- while(isdigit(c)) {x=x*+c-''; c=getchar();}
- }
- const int maxn=;
- int n,m,q;
- int ans[maxn][maxn];
- int op[],r[],c[],v[];
- int main()
- {
- scanf("%d%d%d",&n,&m,&q);
- for(int i=;i<=q;i++)
- {
- scanf("%d",&op[i]);
- if(op[i]==) scanf("%d",&r[i]);
- else if(op[i]==) scanf("%d",&c[i]);
- else scanf("%d%d%d",&r[i],&c[i],&v[i]);
- }
- for(int i=q;i>=;i--)
- {
- if(op[i]==) ans[r[i]][c[i]]=v[i];
- else if(op[i]==)
- {
- for(int j=m;j>;j--)
- swap(ans[r[i]][j],ans[r[i]][j-]);
- }
- else
- {
- for(int j=n;j>;j--)
- swap(ans[j][c[i]],ans[j-][c[i]]);
- }
- }
- for(int i=;i<=n;i++){
- for(int j=;j<=m;j++)
- printf("%d ",ans[i][j]);
- printf("\n");
- }
- return ;
- }
CodeForces 669C Little Artem and Matrix GNU的更多相关文章
- codeforces 669C C. Little Artem and Matrix(水题)
题目链接: C. Little Artem and Matrix time limit per test 2 seconds memory limit per test 256 megabytes i ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) C. Little Artem and Matrix 模拟
C. Little Artem and Matrix 题目连接: http://www.codeforces.com/contest/669/problem/C Description Little ...
- Codeforces 669D Little Artem and Dance (胡搞 + 脑洞)
题目链接: Codeforces 669D Little Artem and Dance 题目描述: 给一个从1到n的连续序列,有两种操作: 1:序列整体向后移动x个位置, 2:序列中相邻的奇偶位置互 ...
- Educational Codeforces Round 9 F. Magic Matrix 最小生成树
F. Magic Matrix 题目连接: http://www.codeforces.com/contest/632/problem/F Description You're given a mat ...
- codeforces 442C C. Artem and Array(贪心)
题目链接: C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- CodeForces - 669D Little Artem and Dance 想法题 多余操作
http://codeforces.com/problemset/problem/669/D 题意:n个数1~N围成一个圈.q个操作包括操作1:输入x, 所有数右移x.操作2:1,2位置上的数(swa ...
- CodeForces 668B Little Artem and Dance
B. Little Artem and Dance time limit per test 2 second memory limit per test 256 megabytes input sta ...
- CodeForces 669C
链接:http://codeforces.com/problemset/problem/669/C http://www.cnblogs.com/Ash-ly/p/5443155.html 题意: 给 ...
- CodeForces 402 E Strictly Positive Matrix
Strictly Positive Matrix 题解: 如果原来的 a[i][j] = 0, 现要 a[i][j] = 1, 那么等于 sum{a[i][k] + a[k][j]} > 1. ...
随机推荐
- vector如何进行局部排序
对于vector的全体排序,我们知道sort(vv.begin(),vv.end())来进行的. 但是对于如果是局部排序的话,比如,vector有100个元素,但我只想对10-80之间的数进行排序,如 ...
- SQL2008R2 无法读取此系统上以前注册的服务器的列表--网上方法不可行
C:\Users\<username>\AppData\Local\Temp,然后创建两个命名为1和2的文件夹
- jQuery全屏插件Textarea Fullscreen
插件描述 Textarea Fullscreen是一个jquery插件,可以将textarea设置为全屏模式 使用方法 引用jquery.js,jquery.textareafullscreen.js ...
- jquery validate 验证
JSP中引入 <link href="themes/gray/easyui.css" rel="stylesheet" type="text/c ...
- 搜索广告与广告网络Demand技术-流式计算平台
流式计算平台-Storm 我们以Storm为例来看流式计算的功能是什么. 下面内容引用自大圆的博客.在Storm中,一个实时应用的计算任务被打包作为Topology发布,这同Hadoop的MapRed ...
- 一键搭键php网站环境的系统
QzzmServer v2.0正式版发布 首先,感谢网友的热情的测评及反馈,现QzzmServer 2.0正式版已发布.有些朋友反馈制作一个服务器专用版本,在下已将此列入计划中,敬请大家耐心等候. Q ...
- RILC
RILC RIL层的作用大体上就是将上层的命令转换成相应的AT指令,控制modem工作.生产modem的厂家有很多:Qualcomm, STE, Infineon... 不同的厂家都有各自的特点,当然 ...
- Kendo UI开发教程(8): Kendo UI 特效概述
Kendo UI Fx 提供了一个丰富,可扩展,性能经过优化的工具集合用来完成HTML元素的过渡显示.每种特效近可能的使用CSS Transition ,对于一些老版本浏览器使用修改属性的方法作为补充 ...
- DIV 实现可拖拽 功能(留档)
//可拖拽 功能 $.fn.extend({ //用法:$(element).jqDrag(); //element需要具备定位属性,需要手动调整层叠样式,这里只是修改鼠标拖动效果 ...
- 使用JavaScript重定向URL参数
本人从网上查找(如有雷同,不胜荣幸.),并进行了修改,简单粗暴,实现使用JavaScript重置url参数 1.字符拼接形式 function setUri(para, val) { var strN ...