模拟。

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

#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的更多相关文章

  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. POJ 1002 UVA 755 487--3279 电话排序 简单但不容易的水题

    题意:给你许多串字符串,从中提取电话号码,输出出现复数次的电话号码及次数. 以下是我艰难的AC历程:(这题估计是我刷的题目题解次数排前的了...) 题目不是很难理解,刚开始想到用map,但stl的ma ...

  2. 谈谈.NET程序集(一)

    谈谈.NET程序集(一) The Assembly in .NET by 唐小崇 http://www.cnblogs.com/tangchong 在.NET出现之前, Windows的程序有一些非常 ...

  3. poj1173 解题报告

    poj1173 解题报告2013-07-21 13:31 by 期待 ., 42 阅读, 0 评论, 收藏, 编辑 http://poj.org/problem?id=1173 发现此题资料甚少,斗胆 ...

  4. 在使用simplexml_load_file()函数读取xml文件时遇到<![CDATA[]]>,怎么让其进行解析

    simplexml_load_file ( '1394.xml', 'SimpleXMLElement', LIBXML_NOCDATA ); 使用这个函数里面的这两个参数

  5. [解决]Windows Server 2012 不能安装IE版的Flash

    1.问题描述 在server 2012下安装IE版的Flash提示包含最新版本 2.解决方法 2.1.开启“桌面体验”功能 2.2.关闭“IE增强的安全配置”功能 3.重启计算机后安装Flash

  6. Hadoop Streaming Command Details and Q&A

    Hadoop Streaming Hadoopstreaming is a utility that comes with the Hadoop distribution. The utilityal ...

  7. sqlserver2005级联删除

    在你建表,建主外键的时候,在下面有几个选项,有一个是级联删除和一个级联更新,勾选上就可以了

  8. iOS-王云鹤 APP首次启动显示用户指导

    这个功能的重点就是在如何判断应用是第一次启动的. 其实很简单 我们只需要在一个类里面写好用户引导页面  基本上都是使用UIScrollView 来实现, 新建一个继承于UIViewController ...

  9. android开发之res下的menu (xml+代码的形式)

    转载请注明出处:http://blog.csdn.net/fth826595345/article/details/9199393 先来看Menu  XML文件如何编写: <?xml versi ...

  10. 分区数据库oracle自动分区

    首先声明,我是一个菜鸟.一下文章中出现技术误导情况盖不负责 oralce在linux下主动备份并删除5天前备份 导出脚本: export ORACLE_BASE=/opt/oracle         ...