| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1133147 | michael12 | Red-blue table (IZhO19_stones) | C++20 | 16 ms | 1352 KiB |
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int T;
cin >> T; // Number of test cases
while (T--) {
int N, M;
cin >> N >> M; // Dimensions of the table
// Initialize the table with an empty string
vector<string> table(N);
if(M==1 || N==1){
if(N==1){
cout<<M<<endl;
for(int i=1; i<=M; i++){
cout<<"-";
}
cout<<endl;
}
else
{
cout<<N<<endl;
for(int i=1; i<=N; i++){
cout<<"+"<<endl;
}
cout<<endl;
}
}
else
{
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M; ++j) {
if ((i + j) % 2 == 0) {
table[i] += '+'; // Red stone
} else {
table[i] += '-'; // Blue stone
}
}
}
// Calculate A + B
int A = N / 2 + (N % 2); // Rows Aidos likes (more '+' than '-')
int B = M / 2 + (M % 2); // Columns Tima likes (more '-' than '+')
cout << A + B << endl; // Output the maximum A + B
// Output the table
for (const auto& row : table) {
cout << row << endl;
}
}
}
return 0;
}| # | 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... | ||||
