제출 #340107

#제출 시각아이디문제언어결과실행 시간메모리
340107kkkRed-blue table (IZhO19_stones)C++14
100 / 100
39 ms3308 KiB
#include<iostream> #include<algorithm> #define endl '\n' using namespace std; long long n,m; char s[1003][1003],ans2[1002][1002]; bool p=false; char k; void sol() { long long i,j,d,a; d=(n-1)/2*m; for(i=0;i<n;i++) { for(j=0;j<m;j++) { ans2[i][j]=k; } } j=0,a=0; for(i=0;i<d;i++) { if(k=='+')ans2[j][i%m]='-'; else ans2[j][i%m]='+';a++; if(2*a>m){j++;a=0;} } cout<<m+j<<endl; if(p)swap(m,n); for(i=0;i<n;i++) { for(j=0;j<m;j++) { if(!p)s[i][j]=ans2[i][j]; else s[i][j]=ans2[j][i]; } } for(i=0;i<n;i++) { for(j=0;j<m;j++) { cout<<s[i][j]; }cout<<endl; } } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t,i,j; cin>>t; for(i=0;i<t;i++) { cin>>n>>m; p=false;k='-'; if(m<=n){swap(n,m);k='+';p=true;} sol(); } }

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

stones.cpp: In function 'void sol()':
stones.cpp:24:9: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   24 |         else ans2[j][i%m]='+';a++;
      |         ^~~~
stones.cpp:24:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   24 |         else ans2[j][i%m]='+';a++;
      |                               ^
stones.cpp: In function 'int main()':
stones.cpp:54:19: warning: unused variable 'j' [-Wunused-variable]
   54 |     long long t,i,j;
      |                   ^
#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...