# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
167425 | tincamatei | Red-blue table (IZhO19_stones) | C++14 | 28 ms | 1912 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;
bool forced = false;
scanf("%d%d", &N, &M);
for(int fixedRows = 0; fixedRows <= N; ++fixedRows) {
int fixedColumns = 0;
int reqCols = (M + 2) / 2, pluses = reqCols * fixedRows;
int fullLayers = pluses / M, overflownLayers = pluses % M, normalLayers = M - overflownLayers;
if(N - fullLayers >= (N + 2) / 2)
fixedColumns += normalLayers;
if(N - (fullLayers + 1) >= (N + 2) / 2)
fixedColumns += overflownLayers;
if(fixedColumns + fixedRows > best) {
best = fixedColumns + fixedRows;
bestFR = fixedRows;
forced = false;
}
fixedColumns = (M - 1) / 2;
if(fixedColumns + fixedRows > best) {
best = fixedColumns + fixedRows;
bestFR = fixedRows;
forced = true;
}
}
for(int r = 0; r < N; ++r)
for(int c = 0; c < M; ++c)
matr[r][c] = '-';
int lastP = 0;
printf("%d\n", best);
for(int i = 0; i < bestFR; ++i) {
for(int j = 0; j < (M + 2) / 2; ++j) {
if(forced)
matr[i][j] = '+';
else
matr[i][lastP] = '+';
lastP = (lastP + 1) % M;
}
}
for(int r = 0; r < N; ++r) {
for(int c = 0; c < M; ++c)
fputc(matr[r][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... |