| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 599095 | M_W | Red-blue table (IZhO19_stones) | C++17 | 90 ms | 1356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
char a[1010][1010];
int main(){
int T;
scanf("%d", &T);
while(T--){
int N, M, state = 0;
scanf("%d %d", &N, &M);
if(N > M){
state = 1;
swap(N, M);
}
for(int i = 1; i <= N; i++){
for(int j = 1; j <= M; j++) a[i][j] = state ? '+' : '-';
}
for(int i = 1; i <= N - (2 - N % 2); i++){
for(int j = (i - 1) % 2; j <= M; j+= 2){
a[i][j] = state ? '-' : '+';
}
}
int ans = 0;
for(int i = 1; i <= N; i++){
int red = 0, blue = 0;
for(int j = 1; j <= M; j++){
if(a[i][j] == '+') red++;
else blue++;
}
if(state && blue > red) ans++;
else if(!state && red > blue) ans++;
}
for(int i = 1; i <= M; i++){
int red = 0, blue = 0;
for(int j = 1; j <= N; j++){
if(a[j][i] == '+') red++;
else blue++;
}
if(!state && blue > red) ans++;
else if(state && red > blue) ans++;
}
printf("%d\n", ans);
for(int i = 1; i <= N; i++){
for(int j = 1; j <= M; j++){
printf("%c", state ? a[j][i] : a[i][j]);
}
printf("\n");
}
}
}
컴파일 시 표준 에러 (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... | ||||
