# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
463634 | 2021-08-11T12:07:10 Z | fcmalkcin | Red-blue table (IZhO19_stones) | C++17 | 38 ms | 3144 KB |
#pragma GCC optimize("Ofast") #pragma GCC optimization("unroll-loops, no-stack-protector") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned ll #define pll pair<ll,ll> #define ff first #define ss second #define pb push_back #define endl "\n" const ll maxn=2e3+100; const ll mod =1e9+7; const ll base=3e18; /// you will be the best but now you just are trash /// goal 5/7 char ans[maxn][maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if (fopen("t.inp", "r")) { freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); } ll t; cin>> t; while (t--) { ll n, m; ll res=0; cin>> n>> m; if (n+(m-1)/2>res) { res=n+(m-1)/2; for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (j<=m-(m-1)/2) { ans[i][j]='+'; } else { ans[i][j]='-'; } } } } if (n>=(n%2?1:2)&&n-(n%2?1:2)+((m-1)/2)*2>res) { res=n-(n%2?1:2)+((m-1)/2)*2; ll len=(m-1)/2; ll len1=(n/2)+1; for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (i<=len1&&j<=len) { ans[i][j]='-'; } else if (i>=n-len1+1&&j>=len+1&&j<=2*len) { ans[i][j]='-'; } else { ans[i][j]='+'; } // cout <<ans[i][j]; } // cout <<endl; } } if ((n-1)/2+m>res) { res=(n-1)/2+m; for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (i<=n-(n-1)/2) { ans[i][j]='-'; } else { ans[i][j]='+'; } } } } if (m>=(m%2?1:2)&&m-(m%2?1:2)+((n-1)/2)*2>res) { res=m-(m%2?1:2)+((n-1)/2)*2; // cout <<res<<endl; ll len=(n-1)/2; ll len1=(m/2)+1; for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (j<=len1&&i<=len) { ans[i][j]='+'; } else if (j>=m-len1+1&&i>=len+1&&i<=2*len) { ans[i][j]='+'; } else { ans[i][j]='-'; } // cout <<ans[i][j]; } // cout <<endl; } } cout <<res<<endl; for (int i=1;i<=n;i++) { for (int j=1;j<=m;j++) cout <<ans[i][j]; cout <<endl; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Incorrect | 2 ms | 448 KB | Wrong answer in test 38 5: 40 < 41 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 1468 KB | Output is correct |
2 | Correct | 32 ms | 2628 KB | Output is correct |
3 | Correct | 33 ms | 3144 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 1548 KB | Wrong answer in test 6 6: 8 < 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Incorrect | 2 ms | 448 KB | Wrong answer in test 38 5: 40 < 41 |