# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337453 | scales | Red-blue table (IZhO19_stones) | C++17 | 85 ms | 9196 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>
/*#ifndef LOCAL_RUN
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("avx2,tune=native")
#endif*/
////////////////////BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
using namespace std;
long long a[1000][1000];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
//freopen("","r",stdin);
//freopen("","w",stdout);
long long t,i,j,mini,x,y,z,q,m,l,r,k,kol,x1,tip,g,maxi,n,y1;
cin>>t;
for(q=0;q<t;q++)
{
cin>>n;
cin>>m;
z=0;
if(n>m)
{
z=1;
swap(m,n);
}
kol=n*m-m*(n/2+1);
kol=kol/(m/2+1);
cout<<m+kol<<endl;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
a[i][j]=0;
}
}
i=0;
j=0;
g=kol*(m/2+1);
while(g!=0)
{
if(a[i][j]==0)
{
g--;
a[i][j]=1;
i++;
j++;
i=i%kol;
j=j%m;
}
else
{
j++;
j=j%m;
}
}
if(z==0)
{
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(a[i][j]==1)
{
cout<<'+';
}
else
{
cout<<'-';
}
}
cout<<endl;
}
}
else
{
for(j=0;j<m;j++)
{
for(i=0;i<n;i++)
{
if(a[i][j]==0)
{
cout<<'+';
}
else
{
cout<<'-';
}
}
cout<<endl;
}
}
}
return 0;
}
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... |