結果

問題 No.1571 All Your Cycles Are Same Lengths
ユーザー the-xinthe-xin
提出日時 2021-06-27 15:11:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 67,192 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 11:45:41
合計ジャッジ時間 1,820 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 300;
int g[N][N];
int main(){
	int T;
	cin>>T;
	while(T--){
		int n,t;
		cin>>n>>t;
		if((n-2)%2==0&&t%2){
			puts("No");
			continue;
		}else{
			puts("Yes");
			int w=0;
			if(n-2!=0)
			w=t/(n-2);
			for(int i=2;i<=n;i++){
				for(int j=i+1;j<=n;j++)
				g[i][j]=w;
			}
			w=t-w*(n-2);
			w/=2;
			for(int i=1;i<=n;i++)
			g[1][i]=w;
			for(int i=1;i<=n;i++){
				for(int j=i+1;j<=n;j++){
					printf("%d %d %d\n",i,j,g[i][j]);
				}
			}
		}
	}
	return 0;
}
0