Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
102385 赵德明 序列变换 C++ 编译错误 0 0 MS 0 KB 607 2023-09-13 13:32:57

Tests(0/0):


#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;


测评信息: