# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172671 | 2020-01-02T10:31:22 Z | ogibogi2004 | Red-blue table (IZhO19_stones) | C++14 | 103 ms | 1528 KB |
#include<bits/stdc++.h> using namespace std; int br[1024]; char table[1024][1024]; void solve() { int n,m,n1,m1; cin>>n>>m; n1=n/2+1; m1=m/2+1; int res2=m+m*(n-n1)/m1; int res1=n+n*(m-m1)/n1; memset(br,0,sizeof(br)); vector<int>v; if(res1>res2) { //cout<<"*\n"; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { table[i][j]='-'; } } for(int j=1;j<=m;j++) { v.clear(); for(int i=1;i<=n;i++) { if(br[i]<n1)v.push_back(i); } for(int i=1;i<=n&&v.size()<=m-m1;i++) { v.push_back(i); } for(int i=0;i<v.size();i++) { table[v[i]][j]='+'; br[v[i]]++; } } } else { for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { table[i][j]='+'; } } for(int i=1;i<=n;i++) { v.clear(); for(int j=1;j<=m;j++) { if(br[j]<m1)v.push_back(j); } for(int j=1;j<=m&&v.size()<=m-m1;j++) { v.push_back(j); } for(int j=0;j<v.size()&&j<=m-m1;j++) { table[i][v[j]]='-'; br[v[j]]++; } } } cout<<max(res1,res2)<<endl; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(table[i][j]=='-')table[i][j]='+'; else table[i][j]='-'; cout<<table[i][j]; } cout<<endl; } } int main() { int t; cin>>t; while(t--)solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | in the table A+B is not equal to 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 376 KB | in the table A+B is not equal to 46 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | in the table A+B is not equal to 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 103 ms | 1508 KB | in the table A+B is not equal to 116 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 75 ms | 1528 KB | in the table A+B is not equal to 44 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | in the table A+B is not equal to 3 |
2 | Halted | 0 ms | 0 KB | - |