# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
168077 | tincamatei | Red-blue table (IZhO19_stones) | C++14 | 30 ms | 2296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000;
char matr[MAX_N][MAX_N];
int main() {
int T, N, M;
scanf("%d", &T);
while(T--) {
int best = 0, bestFR = -1, bestFC = -1;
scanf("%d%d", &N, &M);
int reqPerRow = M / 2 + 1, reqPerCol = N / 2 + 1;
int freePerRow = M - reqPerRow;
for(int fixedRows = 0; fixedRows <= N; ++fixedRows)
for(int fixedCols = 0; fixedCols <= M; ++fixedCols) {
int reqCol = max(0, reqPerCol - (N - fixedRows));
int reqRow = max(0, reqPerRow - (M - fixedCols));
if((long long)reqRow * fixedRows + (long long)reqCol * fixedCols <= (long long)fixedCols * fixedRows && fixedRows + fixedCols > best) {
best = fixedRows + fixedCols;
bestFR = fixedRows;
bestFC = fixedCols;
}
}
int lastP = 0;
for(int l = 0; l < N; ++l)
for(int c = 0; c < M; ++c)
matr[l][c] = '-';
int reqRow = max(0, reqPerRow - (M - bestFC));
for(int l = 0; l < bestFR; ++l) {
for(int c = bestFC; c < M; ++c)
matr[l][c] = '+';
for(int c = 0; c < bestFC && c < reqRow; ++c) {
matr[l][lastP] = '+';
lastP = (lastP + 1) % bestFC;
}
}
printf("%d\n", best);
for(int l = 0; l < N; ++l) {
for(int c = 0; c < M; ++c)
fputc(matr[l][c], stdout);
printf("\n");
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |