B题。。。水题,记录当前行是由原矩阵哪行变来的。

 #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<queue>
#include<stack>
#include<cmath>
#include<algorithm>
#include<malloc.h>
using namespace std;
#define clc(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=;
#define LL long long
const double eps = 1e-;
const double pi = acos(-);
int g[][];
inline int r(){
int x=,f=;char ch=getchar();
while(ch>''||ch<''){if(ch=='-') f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
} int lx[],ly[]; int main(){
int T;
// scanf("%d",&T);
T=r();
while(T--){
int n,m,q;
// scanf("%d%d%d",&n,&m,&q);
n=r(),m=r(),q=r();
for(int i=;i<=n;i++){
for(int j=;j<=m;j++){
g[i][j]=r();
}
}
for(int i=;i<=n;i++)
lx[i]=i;
for(int j=;j<=m;j++)
ly[j]=j;
while(q--){
int a,x,y;
a=r(),x=r(),y=r();
if(a==){
int a=lx[x];int b=lx[y];
lx[x]=b,lx[y]=a;
}
else if(a==){
int a=ly[x];int b=ly[y];
ly[x]=b,ly[y]=a;
}
else if(a==){
for(int i=;i<=m;i++)
g[lx[x]][i]+=y;
}
else {
for(int i=;i<=n;i++){
g[i][ly[x]]+=y;
}
}
}for(int i=;i<=n;i++){
for(int j=;j<=m;j++){
if(j==)
printf("%d",g[lx[i]][ly[j]]);
else printf(" %d",g[lx[i]][ly[j]]);
}
printf("\n");
}
}
return ;
}

BestCoder Round #81 (div.2) B Matrix的更多相关文章

  1. BestCoder Round #81 (div.2) 1004 String(动态规划)

    题目链接:BestCoder Round #81 (div.2) 1003 String 题意 中文题,上有链接.就不贴了. 思路 枚举起点i,计算能够达到k个不同字母的最小下标j,则此时有子串len ...

  2. HDU5569/BestCoder Round #63 (div.2) C.matrix DP

    matrix Problem Description Given a matrix with n rows and m columns ( n+m is an odd number ), at fir ...

  3. BestCoder Round #81 (div.2) 1003 String

    题目地址:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=691&pid=1003题意:找出一个字符串满足至少 ...

  4. BestCoder Round #81 (div.2)C String

    总体思路好想,就是在找K个不同字母的时候,卡时间. 看了大神代码,发现goto的!!!!998ms #include<cstdio> #include<cstring> #in ...

  5. BestCoder Round #81 (div.1)A

    水题...就是n的三进制后m位 #include<cstdio> #include<cstring> #include<cstdlib> #include<i ...

  6. BestCoder Round #81 (div.2)1001

    Machine Accepts: 580 Submissions: 1890 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65 ...

  7. BestCoder Round #81 (div.2)

    HDU:5670~5764 A题: 是一个3进制计数: #include <bits/stdc++.h> using namespace std; ]; int calc(long lon ...

  8. hdoj5671 BestCoder Round #81 (div.2)

    对于交换行.交换列的操作,分别记录当前状态下每一行.每一列是原始数组的哪一行.哪一列即可. 对每一行.每一列加一个数的操作,也可以两个数组分别记录.注意当交换行.列的同时,也要交换增量数组. 输出时通 ...

  9. BestCoder Round #69 (div.2) Baby Ming and Weight lifting(hdu 5610)

    Baby Ming and Weight lifting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K ( ...

随机推荐

  1. CSS 之 @media

    @media 版本:CSS2 兼容性:IE5+ 语法: @media  sMedia  {sRules} 取值: sMedia : 指定设备名称.请参阅设备类型 all, aural, braille ...

  2. 007.Compiled

    Delphi property Compiled: Boolean read FCompiled; 类型:property 可见性:public 所在单元:System.RegularExpressi ...

  3. rman全备份异机恢复

    一.测试环境 [oracle@localhost ~]$ uname -a Linux localhost.localdomain -.el6.x86_64 # SMP Tue May :: EDT ...

  4. c#让窗体永在最前 调用windows api 将窗体设为topmost

    有时候应用程序需要将一个窗体始终位于屏幕的最前面,即使切换到其它窗体也能看到该窗体,这样的窗体就叫做TopMost窗体. 用C#制作TopMost窗体之前,首先要了解如何声明SetWindowPos函 ...

  5. ServiceController组件控制计算机服务

    private void Form1_Load(object sender, EventArgs e) { //下面的示例使用 ServiceController 类检查IIS服务是否已停止.如果该服 ...

  6. EasyUI portal自定义小图标,不是用js方式加载

    <script src="~/Scripts/jquery.portal.js"></script> <script> $(function ( ...

  7. Apple 如何知道你使用了私有API

    大约有三种方式 otool -L这个工具可以清晰的列出你链接所有的库 像IO.Kit是不允许使用的 nm -u 这个工具可以清晰的列出你所有链接符号如 C方法 OC方法 检查所有Selecter的字符 ...

  8. 基于strpos()函数的判断用户浏览器方法

    $_SERVER['HTTP_USER_AGENT'],超全局变量,用来读取客户用的什么浏览器及其版本. strpos(),指定一个字符并搜索是否包含该字符. <html> <hea ...

  9. Java之向左添加零(000001)第二种方法

    //待测试数据 int i = 100; //得到一个NumberFormat的实例 NumberFormat nf = NumberFormat.getInstance(); //设置是否使用分组 ...

  10. codeforces 391C3 - The Tournament

    在第8组数据上WA了一天,后来才发现问题: #include<iostream> #include<cstdio> #include<cstring> #inclu ...