Submission #544856

# Submission time Handle Problem Language Result Execution time Memory
544856 2022-04-02T22:10:18 Z MilosMilutinovic Red-blue table (IZhO19_stones) C++14
0 / 100
2000 ms 632 KB
#include<bits/stdc++.h>

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}
template<typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}

int n,m;

void solve(){
	scanf("%d%d",&n,&m);
	int ans=0,tx=0,ty=0;
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++){
		vector<int> row(n+1),col(m+1);
		for(int x=1;x<=n;x++)for(int y=1;y<=m;y++){
			int b=((x<=i&&y<=j)?-1:1);
			row[x]+=b; col[y]+=b;
		}
		int tans=0;
		for(int x=1;x<=n;x++)if(row[x]>0)tans++;
		for(int y=1;y<=m;y++)if(col[y]<0)tans++;
		if(tans>ans)ans=tans,tx=i,ty=j;
	}
	printf("%d\n",ans);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)printf("%c",(i<=tx&&j<=ty?'-':'+'));
		printf("\n");
	}
}

int main(){
	int T;
	scanf("%d",&T);
	while(T--)solve();
	return 0;
}

Compilation message

stones.cpp: In function 'void solve()':
stones.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |  scanf("%d%d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~
stones.cpp: In function 'int main()':
stones.cpp:43:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |  scanf("%d",&T);
      |  ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 212 KB Wrong answer in test 2 1: 1 < 2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2077 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2072 ms 612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -