Created
September 11, 2012 17:31
-
-
Save brickgao/3700066 to your computer and use it in GitHub Desktop.
Codeforces Round #137 (Div. 2) B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//by Brickgao | |
#include <iostream> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cstring> | |
#include <string> | |
using namespace std; | |
int n, m, k; | |
int row[1010], col[1010]; | |
int rec[1010][1010]; | |
int swaprow(int a, int b) | |
{ | |
int tmp; | |
tmp = row[a]; | |
row[a] = row[b]; | |
row[b] = tmp; | |
return 0; | |
} | |
int swapcol(int a, int b) | |
{ | |
int tmp; | |
tmp = col[a]; | |
col[a] = col[b]; | |
col[b] = tmp; | |
return 0; | |
} | |
int main() | |
{ | |
char ch; | |
int tmp1, tmp2, i, j; | |
while(~scanf("%d%d%d", &n, &m, &k)) | |
{ | |
for(i = 1; i <= n; i++) | |
row[i] = i; | |
for(i = 1; i <= m; i++) | |
col[i] = i; | |
for(i = 1; i <= n; i++) | |
for(j = 1; j <= m; j++) | |
scanf("%d", &rec[i][j]); | |
for(i = 1; i <= k; i++) | |
{ | |
getchar(); | |
scanf("%c %d %d", &ch, &tmp1, &tmp2); | |
if(ch == 'r') swaprow(tmp1, tmp2); | |
if(ch == 'c') swapcol(tmp1, tmp2); | |
if(ch == 'g') printf("%d\n", rec[row[tmp1]][col[tmp2]]); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment