| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 101909 | 梁晨熙 | 矩阵排序 | C++ | Accepted | 100 | 72 MS | 3224 KB | 612 | 2023-09-11 13:53:16 |
#include<bits/stdc++.h> using namespace std; int n,m; int a[5001][5001]; bool check(int x,int y){ for(int i=1;i<=m;i++){ if(a[x][i]<a[y][i]) return 1; if(a[x][i]>a[y][i]) return 0; } } void solve(int x,int y){ for(int i=1;i<=m;i++){ swap(a[x][i],a[y][i]); } } signed main(){ cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; } } for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ if(!check(i,j)){ solve(i,j); } } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cout<<a[i][j]<<" "; } cout<<endl; } return 0; }