제출 #382173

#제출 시각아이디문제언어결과실행 시간메모리
382173BartolMRed-blue table (IZhO19_stones)C++17
0 / 100
69 ms3052 KiB
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; const int INF=0x3f3f3f3f; const int N=1005; int n, m, fl; int mat[N][N], pom[N][N]; void mali() { printf("%d\n", n); } void reset() { for (int i=0; i<n; ++i) for (int j=0; j<m; ++j) mat[i][j]=0; fl=0; } void rotiraj() { for (int i=0; i<n; ++i) for (int j=0; j<m; ++j) pom[j][m-i]=mat[i][j]; swap(n, m); for (int i=0; i<n; ++i) for (int j=0; j<m; ++j) mat[i][j]=!pom[i][j]; } void solve() { int gr_m=m-1-!(m%2); int gr_n=n-1-!(n%2); printf("%d\n", gr_m+gr_n); for (int i=0; i<gr_n; ++i) { for (int j=i%2; j<gr_m; j+=2) mat[i][j]=1; } for (int i=gr_n; i<n; ++i) { for (int j=0; j<m; ++j) mat[i][j]=1; } } void ispis() { for (int i=0; i<n; ++i) { for (int j=0; j<m; ++j) printf("%c", mat[i][j] ? '-' : '+'); printf("\n"); } } int main() { int t; scanf("%d", &t); while (t--) { scanf("%d %d", &n, &m); reset(); fl=n<m; if (fl) swap(n, m); if (m>=3) solve(); else mali(); if (fl) rotiraj(); ispis(); } return 0; }

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

stones.cpp: In function 'int main()':
stones.cpp:62:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   62 |     scanf("%d", &t);
      |     ~~~~~^~~~~~~~~~
stones.cpp:64:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   64 |         scanf("%d %d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~
#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...