# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170239 | 2019-12-24T10:32:45 Z | bgspartan | Red-blue table (IZhO19_stones) | C++14 | 32 ms | 1508 KB |
#include<bits/stdc++.h> #define ll long long using namespace std; const ll maxN=1001; char table[maxN][maxN]; void fillTable(ll n,ll m){ ll mod=n/2+1; if(m>1){ for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(i/mod==j){ table[i][j]='-'; }else{ table[i][j]='+'; } } } }else{ for(int i=0;i<n;i++){ table[i][0]='+'; } } } ll n[maxN],m[maxN]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); ll t,ans1=0,ans2=0; cin>>t; for(int i=0;i<t;i++){ cin>>n[i]>>m[i]; } for(int i=0;i<t;i++){ ll used1=0,used2,lef1=0,lef2; lef1=m[i]-(m[i]/2+1); lef2=n[i]-(n[i]/2+1); ans1=n[i]+lef1; ans2=m[i]+lef2; // cout<<ans1<<" "<<ans2<<"\n"; if(ans1>=ans2){ fillTable(n[i],m[i]); cout<<ans1<<"\n"; for(int j=0;j<n[i];j++){ for(int h=0;h<m[i];h++){ cout<<table[j][h]; } cout<<"\n"; } }else{ fillTable(m[i],n[i]); cout<<ans2<<"\n"; for(int j=n[i]-1;j>=0;j--){ for(int h=0;h<m[i];h++){ if(table[h][j]=='-'){ cout<<"+"; }else{ cout<<"-"; } } cout<<"\n"; } } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | in the table A+B is not equal to 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 504 KB | in the table A+B is not equal to 20 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | in the table A+B is not equal to 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 1508 KB | in the table A+B is not equal to 107 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 1500 KB | in the table A+B is not equal to 35 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | in the table A+B is not equal to 4 |