Submission #231039

# Submission time Handle Problem Language Result Execution time Memory
231039 2020-05-12T12:27:38 Z jamielim Red-blue table (IZhO19_stones) C++14
0 / 100
15 ms 1440 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	int n,m;
	char grid[1005][1005];
	while(t--){
		scanf("%d%d",&n,&m);
		int ans=0;
		int b=0;
		int halfh=ceil((double)(n)/(double)2);
		for(int i=0;i<=m;i++){
			int a=0;
			int l=floor((double)(i*halfh)/(double)(n)),u=ceil((double)(i*halfh)/(double)(n));
			if(2*(m-l)>=m&&2*(m-u)>=m)a=n;
			else if(2*(m-l)>=m)a=max(n/2,n-(i*halfh)%n);
			else a=n/2;
			if(i+a>ans){
				ans=i+a;
				b=i;
			}
		}
		printf("%d\n",ans);
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				grid[i][j]='+';
			}
			grid[i][m]='\0';
		}
		for(int i=0;i<b*halfh;i++){
			grid[i%n][i/halfh]='-';
		}
		for(int i=0;i<n;i++)printf("%s\n",grid[i]);
	}
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&t);
  ~~~~~^~~~~~~~~
stones.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&n,&m);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB in the table A+B is not equal to 6
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB in the table A+B is not equal to 46
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB in the table A+B is not equal to 6
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 1408 KB Wrong answer in test 23 57: 76 < 78
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1440 KB in the table A+B is not equal to 48
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB in the table A+B is not equal to 6