MC_OIer @ 2024-11-02 18:06:04
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[2000005][25],n,m,q;
int p[4000005];
int op,x,y;
bool cmp(int l,int k){
return l<k;
}
namespace FastIO {
char buf[1 << 21], *p1 = buf, *p2 = buf;
#define getchar() (p1 == p2 && (p1 = buf, p2 = (p1 + fread(buf, 1, 1 << 21, stdin))) == p1 ? EOF : *p1++)
template <typename T> inline T read() { T x = 0, w = 0; char ch = getchar(); while (ch < '0' || ch > '9') w |= (ch == '-'), ch = getchar(); while ('0' <= ch && ch <= '9') x = x * 10 + (ch ^ '0'), ch = getchar(); return w ? -x : x; }
template <typename T> inline void write(T x) { if (!x) return; write<T>(x / 10), putchar((x % 10) ^ '0'); }
template <typename T> inline void print(T x) { if (x > 0) write<T>(x); else if (x < 0) putchar('-'), write<T>(-x); else putchar('0'); }
template <typename T> inline void print(T x, char en) { print<T>(x), putchar(en); }
}; using namespace FastIO;
#undef getchar()
signed main(){
n=read<int>();m=read<int>();q=read<int>();
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
a[i][j]=read<int>();
}
}
while(q--){
op=read<int>();x=read<int>();y=read<int>();
if(op==2){
print<int>(a[x][y]);
cout<<endl;
}
else{
for(int i=1;i<=n;i++)p[i]=a[x][i];
for(int i=1;i<=n;i++)p[i+n]=a[y][i];
sort(p+1,p+1+2*n,cmp);
for(int i=1;i<=n;i++)a[x][i]=p[i];
for(int i=1;i<=n;i++)a[y][i]=p[i+n];
}
}
return 0;
}
by MC_OIer @ 2024-11-02 18:07:33
fk nm数组开反唐了