模拟。

把操作记录一下,倒着复原回去。

  1. #pragma comment(linker, "/STACK:1024000000,1024000000")
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<cmath>
  5. #include<algorithm>
  6. #include<vector>
  7. #include<map>
  8. #include<set>
  9. #include<queue>
  10. #include<stack>
  11. #include<iostream>
  12. using namespace std;
  13. typedef long long LL;
  14. const double pi=acos(-1.0),eps=1e-;
  15. void File()
  16. {
  17. freopen("D:\\in.txt","r",stdin);
  18. freopen("D:\\out.txt","w",stdout);
  19. }
  20. template <class T>
  21. inline void read(T &x)
  22. {
  23. char c=getchar(); x=;
  24. while(!isdigit(c)) c=getchar();
  25. while(isdigit(c)) {x=x*+c-''; c=getchar();}
  26. }
  27.  
  28. const int maxn=;
  29. int n,m,q;
  30. int ans[maxn][maxn];
  31. int op[],r[],c[],v[];
  32.  
  33. int main()
  34. {
  35.  
  36. scanf("%d%d%d",&n,&m,&q);
  37. for(int i=;i<=q;i++)
  38. {
  39. scanf("%d",&op[i]);
  40. if(op[i]==) scanf("%d",&r[i]);
  41. else if(op[i]==) scanf("%d",&c[i]);
  42. else scanf("%d%d%d",&r[i],&c[i],&v[i]);
  43. }
  44.  
  45. for(int i=q;i>=;i--)
  46. {
  47. if(op[i]==) ans[r[i]][c[i]]=v[i];
  48. else if(op[i]==)
  49. {
  50. for(int j=m;j>;j--)
  51. swap(ans[r[i]][j],ans[r[i]][j-]);
  52. }
  53. else
  54. {
  55. for(int j=n;j>;j--)
  56. swap(ans[j][c[i]],ans[j-][c[i]]);
  57. }
  58. }
  59.  
  60. for(int i=;i<=n;i++){
  61. for(int j=;j<=m;j++)
  62. printf("%d ",ans[i][j]);
  63. printf("\n");
  64. }
  65. return ;
  66. }

CodeForces 669C Little Artem and Matrix GNU的更多相关文章

  1. 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 ...

  2. 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 ...

  3. Codeforces 669D Little Artem and Dance (胡搞 + 脑洞)

    题目链接: Codeforces 669D Little Artem and Dance 题目描述: 给一个从1到n的连续序列,有两种操作: 1:序列整体向后移动x个位置, 2:序列中相邻的奇偶位置互 ...

  4. Educational Codeforces Round 9 F. Magic Matrix 最小生成树

    F. Magic Matrix 题目连接: http://www.codeforces.com/contest/632/problem/F Description You're given a mat ...

  5. codeforces 442C C. Artem and Array(贪心)

    题目链接: C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  6. CodeForces - 669D Little Artem and Dance 想法题 多余操作

    http://codeforces.com/problemset/problem/669/D 题意:n个数1~N围成一个圈.q个操作包括操作1:输入x, 所有数右移x.操作2:1,2位置上的数(swa ...

  7. 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 ...

  8. CodeForces 669C

    链接:http://codeforces.com/problemset/problem/669/C http://www.cnblogs.com/Ash-ly/p/5443155.html 题意: 给 ...

  9. 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. ...

随机推荐

  1. vector如何进行局部排序

    对于vector的全体排序,我们知道sort(vv.begin(),vv.end())来进行的. 但是对于如果是局部排序的话,比如,vector有100个元素,但我只想对10-80之间的数进行排序,如 ...

  2. SQL2008R2 无法读取此系统上以前注册的服务器的列表--网上方法不可行

    C:\Users\<username>\AppData\Local\Temp,然后创建两个命名为1和2的文件夹

  3. jQuery全屏插件Textarea Fullscreen

    插件描述 Textarea Fullscreen是一个jquery插件,可以将textarea设置为全屏模式 使用方法 引用jquery.js,jquery.textareafullscreen.js ...

  4. jquery validate 验证

    JSP中引入 <link href="themes/gray/easyui.css" rel="stylesheet" type="text/c ...

  5. 搜索广告与广告网络Demand技术-流式计算平台

    流式计算平台-Storm 我们以Storm为例来看流式计算的功能是什么. 下面内容引用自大圆的博客.在Storm中,一个实时应用的计算任务被打包作为Topology发布,这同Hadoop的MapRed ...

  6. 一键搭键php网站环境的系统

    QzzmServer v2.0正式版发布 首先,感谢网友的热情的测评及反馈,现QzzmServer 2.0正式版已发布.有些朋友反馈制作一个服务器专用版本,在下已将此列入计划中,敬请大家耐心等候. Q ...

  7. RILC

    RILC RIL层的作用大体上就是将上层的命令转换成相应的AT指令,控制modem工作.生产modem的厂家有很多:Qualcomm, STE, Infineon... 不同的厂家都有各自的特点,当然 ...

  8. Kendo UI开发教程(8): Kendo UI 特效概述

    Kendo UI Fx 提供了一个丰富,可扩展,性能经过优化的工具集合用来完成HTML元素的过渡显示.每种特效近可能的使用CSS Transition ,对于一些老版本浏览器使用修改属性的方法作为补充 ...

  9. DIV 实现可拖拽 功能(留档)

    //可拖拽 功能 $.fn.extend({    //用法:$(element).jqDrag();    //element需要具备定位属性,需要手动调整层叠样式,这里只是修改鼠标拖动效果    ...

  10. 使用JavaScript重定向URL参数

    本人从网上查找(如有雷同,不胜荣幸.),并进行了修改,简单粗暴,实现使用JavaScript重置url参数 1.字符拼接形式 function setUri(para, val) { var strN ...