QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#807872#9874. Matrix Constructionucup-team4975#Compile Error//C++23969b2024-12-10 13:46:552024-12-10 13:46:56

Judging History

你现在查看的是最新测评结果

  • [2024-12-10 13:46:56]
  • 评测
  • [2024-12-10 13:46:55]
  • 提交

answer

#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'
#define debug(x) cout << #x << ":: " << x << endl;

#define FINISH cout << "FINISH" << endl;

#define debugv(x) cout << #x << ":: ";\
    for (auto i : x)                \
        cout << i << " ";           \
    cout << endl

using namespace std;

using ll = long long;
using PII = pair<int, int>;
const int inf = 0x3f3f3f3f;
const int N = 200020;


void solve()
{
	int n,m;
	cin>>n>>m;
	cout<<"YES\n";
	vector<vector<int>> a(n,vector<int>(m,0));
	int cnt=0;
	for(int i=0;i<n+m-1;i++){
		for(int j=0;j<=i;j++){
			int x=j,y=i-j;
			if(x>=0&&x<n&&y>=0&&y<m){
				cnt++;
				a[x][y]=cnt;
			}
		}
	}
	for(auto x:a){
		for(int y:x){
			cout<<y<<" ";
		}
		cout<<"\n";
	}
	return;
}

int main() 
{
	ios:: sync_with_stdio("false");
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T= 1;
	cin>>T;2 3
	while (T--) {
		solve();
	}
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:53:17: error: expected ‘;’ before numeric constant
   53 |         cin>>T;2 3
      |                 ^~
      |                 ;