제출 #1156495

#제출 시각아이디문제언어결과실행 시간메모리
1156495hashimaliRed-blue table (IZhO19_stones)C++20
32 / 100
15 ms1608 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define endl '\n' #define ld long double #define pb push_back #define pf push_front #define mod 998244353 #define se second #define fi first #define all(ls) (ls).begin(),(ls).end() #define int long long using namespace std; using namespace __gnu_pbds; template<typename type>using ordered_set=tree<type,null_type,less<type>,rb_tree_tag,tree_order_statistics_node_update>; template<typename type>using ordered_multiset=tree<type,null_type,less_equal<type>,rb_tree_tag,tree_order_statistics_node_update>; void solve(){ int n,m; cin>>n>>m; char grid[n][m]; if(n<m){ for(int i=0;i<m;i++) for(int j=0;j<n;j++) grid[i][j]='-'; int tot=0,j=m; int cnt=(n-1)/2; while(cnt--){ for(int i=0;i<m;i++){ grid[i][j-m]='+'; if(tot==(m/2)){ j++; tot=0; } else tot++; } } cout<<j<<endl; for(int i=0;i<n;i++){ for(int j=0;j<m;j++) cout<<grid[j][i]; cout<<endl; } cout<<endl; } else{ for(int i=0;i<n;i++) for(int j=0;j<m;j++) grid[i][j]='+'; int tot=0,j=n; int cnt=(m-1)/2; while(cnt--){ for(int i=0;i<n;i++){ grid[i][j-n]='-'; if(tot==(n/2)){ j++; tot=0; } else tot++; } } cout<<j<<endl; for(int i=0;i<n;i++){ for(int j=0;j<m;j++) cout<<grid[i][j]; cout<<endl; } cout<<endl; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; cin>>t; for(int i=1;i<=t;i++){ // cout<<"Scenario #"<<i<<":"<<" "; solve(); } }
#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...