답안 #161560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
161560 2019-11-03T06:45:51 Z MvC Red-blue table (IZhO19_stones) C++11
27 / 100
33 ms 1596 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e3+50;
const int mod=1e9+7;
int t,i,j,n,m,x;
pair<int,int>rs;
char c[nmax][nmax];
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>t;
	while(t--)
	{
		cin>>n>>m;
		rs=mkp(0,0);
		for(i=0;i<=n;i++)
		{
			x=m-(m/2+1)+i;
			if(n-i>=n/2+1)x+=m/2+1;
			rs=max(rs,mkp(x,i));
		}
		for(i=1;i<=n;i++)for(j=1;j<=m;j++)c[i][j]='-';
		for(i=1;i<=rs.sc;i++)for(j=1;j<=m/2+1;j++)c[i][j]='+';
		cout<<rs.fr<<'\n';
		for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)cout<<c[i][j];
			cout<<'\n';
		}
	}
	return 0;
}

Compilation message

stones.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
stones.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 420 KB Output is correct
4 Incorrect 4 ms 504 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 1444 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 1596 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 420 KB Output is correct
4 Incorrect 4 ms 504 KB Wrong answer in test 5 29: 31 < 32