Submission #1231069

#TimeUsernameProblemLanguageResultExecution timeMemory
1231069hitsuujRed-blue table (IZhO19_stones)C++20
27 / 100
37 ms1608 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define pii pair<int,int> #define fi first #define se second #define inf LLONG_MAX #define ti tuple<int,int,int> signed main(){ int t;cin>>t;while(t--){ int n,m;cin>>n>>m; int grid[n+10][m+10]; memset(grid,0,sizeof(grid)); int mew[n+10][m+10]; memset(mew,0,sizeof(mew)); //all red int ans=n,ans2=m; for(int j=1;j<(m+1)/2;j++){ for(int i=1;i<=n;i++){ grid[i][j]=1; } ans++; } //all blue for(int i=1;i<(n+1)/2;i++){ for(int j=1;j<=m;j++){ mew[i][j]=1; } ans2++; } if(ans>ans2){ cout<<ans<<endl; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(grid[i][j]) cout<<'-'; else cout<<'+'; } cout<<endl; } cout<<endl; } else{ cout<<ans2<<endl; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(!mew[i][j]) cout<<'-'; else cout<<'+'; } cout<<endl; } cout<<endl; } } } // Row red>blue // Col red<blue // val less than half // val more than half // +--+ // +--+ // ++++ // -++ // --- // --- // --- // +++- // ---- // ---- // +-++ // +-++ // ++ // ++ // ++ // ++ // +++ // +++ // +++
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...