# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167681 | 2019-12-09T12:42:18 Z | beso123 | Red-blue table (IZhO19_stones) | C++14 | 134 ms | 1508 KB |
#include<bits/stdc++.h> #define int long long using namespace std; int t; bool sort21(pair<int,int> a,pair<int,int> b){ return a.first<b.first; } main(){ cin>>t; while(t--){ int n,m; cin>>n>>m; int M=(n/2)+1; int N=(m/2)+1; int a[n+1][m+1]; int b[max(n,m)+1]; for(int k=1;k<=n;k++){ b[k]=0; for(int i=1;i<=m;i++) a[k][i]=0; } if(n>=m){ int ans=n; for(int i=1;i<=m;i++){ vector<pair<int,int> > v; for(int k=1;k<=n;k++){ v.push_back({b[k],k}); } sort(v.begin(),v.end(),sort21); if(v[N-1].first==N-2) break; ans++; for(int k=0;k<N;k++){ a[v[k].second][i]=1; b[v[k].second]++; } } cout<<ans<<endl; for(int k=1;k<=n;k++){ for(int i=1;i<=m;i++) if(a[k][i]) cout<<'-'; else cout<<'+'; cout<<endl; } } else{ int ans=m; for(int i=1;i<=n;i++){ vector<pair<int,int> > v; for(int k=1;k<=m;k++){ v.push_back({b[k],k}); } sort(v.begin(),v.end(),sort21); if(v[M-1].first==M-2) break; ans++; for(int k=0;k<M;k++){ a[i][v[k].second]=1; b[v[k].second]++; } } cout<<ans<<endl; for(int k=1;k<=n;k++){ for(int i=1;i<=m;i++) if(a[k][i]) cout<<'+'; else cout<<'-'; cout<<endl; } } } 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 4 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 376 KB | Wrong answer in test 3 45: 45 < 46 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | in the table A+B is not equal to 4 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 134 ms | 1372 KB | in the table A+B is not equal to 118 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 105 ms | 1508 KB | Wrong answer in test 19 19: 34 < 36 |
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 4 |
2 | Halted | 0 ms | 0 KB | - |