# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
286843 | tqbfjotld | Red-blue table (IZhO19_stones) | C++14 | 49 ms | 1360 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(){
int T;
scanf("%d",&T);
for (int t = 0; t<T; t++){
int a,b;
scanf("%d%d",&a,&b);
int besta = 0, bestb = b;
int reqa = b/2+1;
int reqb = (a-1)/2;
int curb = b;
for (int x = 1; x<=a; x++){
while (x*(reqa-(b-curb))>reqb*curb){
curb--;
}
if (x+curb>besta+bestb){
besta = x;
bestb = curb;
}
}
printf("%d\n",besta+bestb);
int curC = b-bestb;
for (int y = 0; y<besta; y++){
int cn = reqa-(b-bestb);
for (int x = 0; x<b; x++){
if (x<b-bestb){
printf("+");
}
else if ((curC+cn>=b && (curC+cn-bestb>x||x>=curC))||(curC+cn<b&&(x>=curC && x<curC+cn))){
printf("+");
}
else{
printf("-");
}
}
curC+=cn;
if (curC>=b) curC-=bestb;
printf("\n");
}
for (int x = besta; x<a; x++){
for (int y = 0; y<b; y++){
printf("-");
}
printf("\n");
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |