Submission #683693

# Submission time Handle Problem Language Result Execution time Memory
683693 2023-01-19T05:40:15 Z Temkabat Red-blue table (IZhO19_stones) C++14
17 / 100
54 ms 1292 KB
#include <iostream>
using namespace std;
int main() {
    int T;
    cin>>T;
    for (int i = 0; i < T; i++){
        int N, M;
        bool rotated=false;
        cin>>N>>M;
        char table[N][M];
        if(N>M){
            int t;
            t=N;
            N=M;
            M=t;
            rotated=true;
        }
        int a=M/2+1, b;
        int c=N/2;
        int d=N%2;
        if(N==1 and M==1){
            cout<<"1\n+\n";
        }else{
			b=min( N, (c - !(d)) * M / a );
            cout<<M+b<<"\n";
            for(int k=0;k<N;k++){
                for(int l=0;l<M;l++){
                    if(rotated==true){
                        table[k][l]='+';
                    }
                    else{
                        table[k][l]='-';
                    }
                }
            }
            for(int k=0, l=0; k<b; k++){
                for(int n=0; n<a; n++,l++){
                    if(l>M){
                        l=1;
                    }
                    if(rotated==true){
                        table[k][l]='-';
                    }
                    else{
                        table[k][l]='+';
                    }
                }
            }
            if(rotated==false){
                for(int k=0;k<N;k++){
                    for(int l=0;l<M;l++){
                        cout<<table[k][l];
                    }
                    cout<<endl;
                }
            }
            else{
                for(int k=0;k<M;k++){
                    for(int l=0;l<N;l++){
                        cout<<table[l][k];
                    }
                    cout<<endl;
                }
            }
		}
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 212 KB in the table A+B is not equal to 17
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 8 ms 212 KB in the table A+B is not equal to 17
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 1292 KB in the table A+B is not equal to 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 1180 KB in the table A+B is not equal to 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 8 ms 212 KB in the table A+B is not equal to 17
4 Halted 0 ms 0 KB -