# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338942 | 2020-12-24T10:15:21 Z | jenkinsser | Red-blue table (IZhO19_stones) | C++17 | 78 ms | 1516 KB |
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define vi vector<int> #define st first #define nd second #define pii pair<int,int> #define N 200005 #define INF 1000000005 #define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define all(x) (x).begin(),(x).end() #define ll long long #define int ll using namespace std; int n,m,ans; int cnt[N]; void solve(){ cin >> n >> m; char table[n+1][m+1]; int ans; if(n>=m){ for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ table[i][j]='+'; } } ans=n; int cur=1; int l=n*(m-1)/(n+2); for(int i=1;i<=n;i++){ for(int j=1;j<=(m-1)/2;j++){ table[i][cur]='-'; cnt[cur]++; cur++; if(cur-1==l) cur=1; } } for(int i=1;i<=l;i++){ if(cnt[i]>=n/2+1) ans++; cnt[i]=0; } } else{ for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ table[i][j]='-'; } } ans=m; int cur=1; int l=m*(n-1)/(m+2); for(int i=1;i<=m;i++){ for(int j=1;j<=(n-1)/2;j++){ table[cur][i]='+'; cnt[cur]++; cur++; if(cur-1==l) cur=1; cnt[i]=0; } } for(int i=1;i<=l;i++){ if(cnt[i]>=m/2+1) ans++; } } cout << ans << endl; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cout << table[i][j]; } cout << endl; } } int32_t main(){ fastio() int t=1; cin >> t; while(t--) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Wrong answer in test 4 4: 4 < 5 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Wrong answer in test 4 4: 4 < 5 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 78 ms | 1516 KB | in the table A+B is not equal to 59 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 57 ms | 1388 KB | Wrong answer in test 24 24: 36 < 44 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Wrong answer in test 4 4: 4 < 5 |