求助,感觉自己的做法没问题,但是WA
查看原帖
求助,感觉自己的做法没问题,但是WA
1259442
Synthwave楼主2024/6/2 17:08

代码如下

#include<bits/stdc++.h>
using namespace std;
#define rep(x,y,z) for(int x=y;x<=z;x++)
#define per(x,y,z) for(int x=y;x>=z;x--)
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define endl '\n'
typedef long long LL;
const int N=2e5+5,MOD=1e6+7;
int n;
void solve(){
	cin>>n;
	int res=0;
	rep(i,1,n) res+=i*(2*i-1);
	cout<<res<<" "<<2*n<<endl;
	cout<<"1 1 ";
	rep(i,1,n) cout<<i<<" ";
	cout<<endl;
		rep(i,2,n){
			cout<<"2 "<<i<<" ";
			rep(j,1,n) cout<<j<<" ";
			cout<<endl;
		}
		rep(i,1,n-1){
			cout<<"1 "<<i<<" ";
			rep(j,1,n) cout<<j<<" ";
			cout<<endl;
		}
		cout<<"2 1 ";
		rep(j,1,n) cout<<j<<" ";
		cout<<endl;
}
int main(){
	IOS;
	int T;
	cin>>T;
	// T=1;
	while(T--){
		solve();
		// cout<<endl;
	}
	return 0;
}
2024/6/2 17:08
加载中...