結果

問題 No.991 N×Mマス計算(構築)
ユーザー kotatsugame
提出日時 2020-02-07 05:34:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 70,304 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-25 07:11:26
合計ジャッジ時間 2,483 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;
int N,M;
char op;
long A[1<<17],B[1<<17];
long K,X;
main()
{
	cin>>X;
	if(X==0)
	{
		N=1;
		M=2;
		K=2;
		A[0]=B[0]=B[1]=1;
	}
	else if(X<=5e4)
	{
		K=1e9;
		N=1;
		M=2*X;
		A[0]=1;
		for(int j=0;j<X;j++)B[j]=K;
		for(int j=X;j<M;j++)B[j]=1;
	}
	else
	{
		K=1e9;
		M=5e4;
		N=X/M+1;
		int L=N*M-X;
		for(int i=0;i<N-1;i++)A[i]=1e9;
		A[N-1]=1;
		B[0]=X-(L-1);
		for(int j=1;j<L;j++)B[j]=1;
		for(int j=L;j<M;j++)B[j]=1e9;
	}
	cout<<N<<" "<<M<<" "<<K<<endl;
	cout<<"*";
	for(int j=0;j<M;j++)cout<<" "<<B[j];
	cout<<endl;
	for(int i=0;i<N;i++)cout<<A[i]<<endl;
}
0