답안 #157051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
157051 2019-10-09T09:29:31 Z AKaan37 Red-blue table (IZhO19_stones) C++17
27 / 100
260 ms 2412 KB
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long lo;
typedef pair< lo,lo > PII;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
 
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
 
int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
map<int,int> vis[1005];
vector<int> v;
 
int main(void){
	scanf("%d",&t);
	while(t--){
		cev=0;
		int cevap=0;
		scanf("%d %d",&n,&m);
		FOR vis[i].clear();
		if(n>=m){
			int at=(m+2)/2;
			int son=1;
			FOR{
				son=1;
				while(son<=at){vis[i][son]=1;son++;}
			}
			
			for(int j=1;j<=m;j++){
				cev=0;
				FOR{
					if(vis[i][j]==0)cev++;
				}
				if(cev>n/2)cevap++;
			}
			for(int j=1;j<=n;j++){
				cev=0;
				for(int i=1;i<=m;i++){
					if(vis[j][i]==1)cev++;
				}
				//~ cout<<cev<<"**\n"<<endl;
				if(cev>m/2)cevap++;
			}
			printf("%d\n",cevap);
			for(int i=1;i<=n;i++){
				for(int j=1;j<=m;j++){
					if(vis[i][j]==1)printf("+");
					else printf("-");
				}
				printf("\n");
			}
		}
		else{
			int at=(n+2)/2;
			int son=1;
			for(int j=1;j<=m;j++){
				son=1;
				vis[1][j]=1;
				while(son<at)vis[++son][j]=1;
			}
			for(int j=1;j<=m;j++){
				cev=0;
				FOR{
					if(vis[i][j]==1)cev++;
				}
				if(cev>n/2)cevap++;
			}
			for(int j=1;j<=n;j++){
				cev=0;
				for(int i=1;i<=m;i++){
					if(vis[j][i]==0)cev++;
				}
				if(cev>m/2)cevap++;
			}
			printf("%d\n",cevap);
			for(int i=1;i<=n;i++){
				for(int j=1;j<=m;j++){
					if(vis[i][j]==1)printf("-");
					else printf("+");
				}
				printf("\n");
			}
		}
	}
	return 0;
}

Compilation message

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]
  scanf("%d",&t);
  ~~~~~^~~~~~~~~
stones.cpp:47:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&n,&m);
   ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 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 5 ms 376 KB Output is correct
4 Incorrect 9 ms 504 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 216 ms 1784 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 260 ms 2412 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 5 ms 376 KB Output is correct
4 Incorrect 9 ms 504 KB Wrong answer in test 5 29: 31 < 32