제출 #493014

#제출 시각아이디문제언어결과실행 시간메모리
493014khangalRed-blue table (IZhO19_stones)C++14
0 / 100
14 ms324 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef double db; typedef vector<long long> vl; typedef pair<long long, long long > pl; const int N = 1e6 + 1; #define po pop_back #define pb push_back #define mk make_pair #define lw lower_bound #define up upper_bound #define ff first #define ss second #define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0); #define MOD 1000000007 #define MAX 1e18 #define MIN -1e18 #define per(i,a,b) for(ll i=b;i>=a;i--) #define con continue #define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout); #define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628 // typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; // template< typename T> // using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; ll n, m, ans, mid, mn, mx, cnt, sum, h1, h2, arr[3234567],arr1[1234567], sz, k, i, j, h, a, w, x, y, z,par[1234567]; bool used[1234567]; //ll dx[4]={-1,1,0,0},dy[4]={0,0,-1,1},c1[123][123]; //vector<ll> edge[1234567]; //ll jump[22][223456]; //ll lvl[1234567]; //ll bit[1234567]; //ll timer; //ll st[1234567],endd[1234567]; //pl tr[1234567]; //ll dp[5005][5005]; ll power(ll base, ll val, ll mod) { ll res = 1; while (val) { if (val % 2 == 1) { res = res * base; } base = base * base; base %= mod; res %= mod; val /= 2; } return res; } bool comp(pl x,pl y){ if(x.ff>y.ff)return true; return false; } ll find(ll x){ if(x==par[x])return x; else return par[x]=find(par[x]); } class A { public: static void funcA() { cin>>n>>m; char grid[n+1][m+1]; ans=MIN; ll id=0; if(n<=4&&m<=4){ for(int msk=0;msk<(1<<(n*m));msk++){ for(int j=0;j<n*m;j++){ if(msk&(1<<j)){ grid[j/m+1][((j-1)%m+1)]='-'; } else grid[j/m+1][((j-1)%m+1)]='+'; } /*cout<<msk<<'\n'; for(int i=0;i<=n;i++){ for(int j=0;j<=m;j++){ cout<<grid[i][j]<<" "; } cout<<'\n'; }*/ ll cnt=0; for(int i=1;i<=n;i++){ ll x=0,y=0; for(int j=1;j<=m;j++)x+=(grid[i][j]=='-'),y+=(grid[i][j]=='+'); if(y>x)cnt++; } for(int i=1;i<=m;i++){ ll x=0,y=0; for(int j=1;j<=n;j++){ x+=(grid[j][i]=='-'); y+=(grid[j][i]=='+'); } if(x>y)cnt++; } if(ans<cnt){ ans=cnt; id=msk; } } for(int j=0;j<n*m;j++){ if(id&(1<<j)){ grid[(j+1)/m][(j%m+1)]='-'; } else grid[(j+1)/m][(j%m+1)]='+'; } cout<<ans<<'\n'; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cout<<grid[i][j]<<" "; } cout<<'\n'; } return; } if(n<=3){ if(n==1 || n==2){ cout<<m<<'\n'; for(int j=1;j<=n;j++){for(int i=1;i<=m;i++)cout<<'-';cout<<'\n';} return; } else{ cout<<m+1<<'\n'; for(int i=1;i<=m;i++)cout<<'-';cout<<'\n'; for(int i=1;i<=m;i++)cout<<'+';cout<<'\n'; for(int i=1;i<=m;i++)cout<<'-';cout<<'\n'; return; } } if(m<=3){ if(m==1 || m==2){ cout<<n<<'\n'; for(int j=1;j<=n;j++){for(int i=1;i<=m;i++)cout<<'-';cout<<'\n';} } else{ cout<<n+1<<'\n'; for(int i=1;i<=n;i++)cout<<"-+-"<<'\n'; } return; } } }lol; void solve() { A::funcA(); } int main() { ll T = 1; cin>>T; boost; while (T--) { solve(); } }

컴파일 시 표준 에러 (stderr) 메시지

stones.cpp: In static member function 'static void A::funcA()':
stones.cpp:125:17: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  125 |                 for(int i=1;i<=m;i++)cout<<'-';cout<<'\n';
      |                 ^~~
stones.cpp:125:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  125 |                 for(int i=1;i<=m;i++)cout<<'-';cout<<'\n';
      |                                                ^~~~
stones.cpp:126:17: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  126 |                 for(int i=1;i<=m;i++)cout<<'+';cout<<'\n';
      |                 ^~~
stones.cpp:126:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  126 |                 for(int i=1;i<=m;i++)cout<<'+';cout<<'\n';
      |                                                ^~~~
stones.cpp:127:17: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  127 |                 for(int i=1;i<=m;i++)cout<<'-';cout<<'\n';
      |                 ^~~
stones.cpp:127:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  127 |                 for(int i=1;i<=m;i++)cout<<'-';cout<<'\n';
      |                                                ^~~~
#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...