# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340684 | 2020-12-28T07:45:15 Z | David_M | Red-blue table (IZhO19_stones) | C++14 | 2000 ms | 61548 KB |
#include <bits/stdc++.h> #define ll long long #define pb push_back #define F first #define S second using namespace std; const ll N=1000006; int n, m, q, o, ans; string x, y; int main(){ios_base::sync_with_stdio(false), cin.tie(0); cin>>q; while(q--){x="";o=0; cin>>n>>m; if(n==1){cout<<m<<endl;while(m--)cout<<'-';cout<<'\n';continue;} if(m==1){cout<<n<<endl;while(n--)cout<<"+\n";continue;} if(n==2){cout<<m<<endl;while(m--)cout<<'-';cout<<'\n';while(m--)cout<<'-';cout<<'\n';continue;} if(m==2){cout<<n<<endl;while(n--)cout<<"++\n";continue;} if(n==3){cout<<m+1<<endl;while(m--)cout<<'-';cout<<'\n';while(m--)cout<<'-';cout<<'\n';while(m--)cout<<'+';cout<<'\n';continue;} if(m==3){cout<<n+1<<endl;while(n--)cout<<"++-\n";continue;} if(n==4){cout<<m+1<<endl;while(m--)cout<<'-';cout<<'\n';while(m--)cout<<'-';cout<<'\n';while(m--)cout<<'-';cout<<'\n';while(m--)cout<<'+';cout<<'\n';continue;} if(m==4){cout<<n+1<<endl;while(n--)cout<<"+++-\n";continue;} ans=n+m-2; if(n%2==0)ans--; if(m%2==0)ans--,m--,o=1; cout<<ans<<'\n'; if(n%2==0){for (int i=1; i<=m; i++)cout<<'-';if(o)cout<<'-';cout<<'\n';n--;} for (int i=1; i<=m/2; i++)x+='-'; for (int i=1; i<=m/2+1; i++)x+='+'; if(o)x+='+'; for (int i=1; i<=n/2; i++)cout<<x<<'\n'; for (int i=0; i<m-1; i++)x[i]='-'; x[m-1]='+'; cout<<x<<'\n'; x=""; for (int i=1; i<=m/2; i++)x+='+'; for (int i=1; i<=m/2; i++)x+='-'; x+='+'; if(o)x+='+'; for (int i=1; i<=n/2; i++)cout<<x<<'\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2035 ms | 59400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2065 ms | 60156 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2035 ms | 59400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2071 ms | 60604 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2065 ms | 61548 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2035 ms | 59400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |