模拟。

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

#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. 够快网盘支持与iOS-ASIHTTPRequest框架学习

    够快网盘支持与iOS-ASIHTTPRequest框架学习 前段时间在公司的产品中支持了够快网盘,用于云盘存储. 在这个过程中,学习到了很多新的知识,也遇到了很多问题,在此记录一下. 首先就够快的AP ...

  2. ASP.NET WebForm 的路由

    ASP.NET WebForm 的路由 偷会闲, 看看博客园, 有筒子写了篇: ASP.NET的路由 我翻了翻两前的一份邮件, 是我当时在项目之余的时间研究的,那时还没用MVC,所有项目都是 WebF ...

  3. mac在线恢复教程

    上个周,我本来想升级一下Xcode,可是我的系统是10.8de,xcode5.0.1 最低支持10.8.4 所以就想升级一下我的mac的系统,可是因为我的appstore 是从别人的电脑上考过来的,要 ...

  4. struts2文件上传大小限制问题

    struts2默认文件上传大小为2M,如需修改默认大小,解决方法如下: <struts> <constant name="struts.multipart.maxSize& ...

  5. [原创]opencv实现图像拼接,制做全景图

     转载请注明:http://www.cnblogs.com/ausk/p/3332255.html    调用opencv2.4.6中的库函数,实现图像的拼接功能,傻瓜式拼接,不需要太多的专业知识.. ...

  6. C++函数调用

    C++函数调用(1) 这篇博客名字起得可能太自大了,搞得自己像C++大牛一样,其实并非如此.C++有很多隐藏在语法之下的特性,使得用户可以在不是特别了解的情况下简单使用,这是非常好的一件事情.但是有时 ...

  7. 用maven来创建web工程

    大约已经一个月没有写博客了,一个是最近太忙,另外啊还是人慢慢的变懒,最近在拆pool,用到了maven,因此呢把自己的一些心得记下来了,供大家参考,欢迎指正. 1.配置maven环境: 首先下载mav ...

  8. 墙上时钟时间 ,用户cpu时间 ,系统cpu时间

    一. 墙上时钟时间 ,用户cpu时间 ,系统cpu时间定义与联系 时钟时间(墙上时钟时间wall clock time):从进程从开始运行到结束,时钟走过的时间,这其中包含了进程在阻塞和等待状态的时间 ...

  9. Python爬虫学习——使用Cookie登录新浪微博

    1.首先在浏览器中进入WAP版微博的网址,因为手机版微博的内容较为简洁,方便后续使用正则表达式或者beautifulSoup等工具对所需要内容进行过滤 https://login.weibo.cn/l ...

  10. ASP.NET网站运行常见错误以及解决方法(持续更新)

    一.A potentially dangerous Request.Form value was detected from the client 用户在页面上提交表单到服务器时,服务器会检测到一些潜 ...