Submission #498322

#TimeUsernameProblemLanguageResultExecution timeMemory
498322IOI_champion_in_1980Red-blue table (IZhO19_stones)C++14
0 / 100
47 ms1396 KiB
#include <bits/stdc++.h> #include <math.h> typedef long long ll; using namespace std; ll i, j, t, a, n, m, b, c, d, f, g; char ch[1010][1010]; void quickSort(int *array, int low, int high) { int i=low;int j=high;int pivot=array[(i + j)/2];int temp;while(i<=j){while(array[i]<pivot)i++;while(array[j]>pivot)j--; if(i<=j){temp=array[i];array[i]=array[j];array[j]=temp;i++;j--;}}if(j>low)quickSort(array,low,j);if(i<high)quickSort(array,i,high); } int binarySearch(int array[], int x, int low, int high) { while(low<=high){int mid=low+(high-low)/2;if(array[mid]==x)return mid; if(array[mid]<x)low=mid+1;else high=mid-1;}return -1; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin>>t; for (i=1; i<=t; i++) { cin>>n>>m; if (n<m) { if (n==1 or n==2) { cout<<m<<endl; for (a=1; a<=n; a++) { for (b=1; b<=m; b++) cout<<'-'; cout<<endl; } continue; } else { cout<<m+((n-3)/2)+1<<endl; for (a=1; a<=2; a++) { for (b=1; b<=m; b++) cout<<'-'; cout<<endl; } for (a=1; a<=m; a++) cout<<'+'; cout<<endl; for (a=4; a<=n; a++) { if (a%2==0) for (b=1; b<=m; b++) cout<<'-'; else for (b=1; b<=m; b++) cout<<'+'; cout<<endl; } continue; } } else { if (m==1 or m==2) { cout<<n<<endl; for (a=1; a<=n; a++) { for (b=1; b<=m; b++) cout<<'+'; } cout<<endl; continue; } else { cout<<n+((m-3)/2)+1<<endl; for (a=1; a<=2; a++) { for (b=1; b<=n; b++) ch[b][a]='+'; } for (a=1; a<=n; a++) ch[a][3]='-'; for (a=4; a<=m; a++) { if (a%2==0) for (b=1; b<=n; b++) ch[b][a]='+'; else for (b=1; b<=n; b++) ch[b][a]='-'; } for (a=1; a<=n; a++) { for (b=1; b<=m; b++) cout<<ch[a][b]; cout<<endl; } } } } } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...