답안 #337833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
337833 2020-12-21T20:39:38 Z mosiashvililuka Red-blue table (IZhO19_stones) C++14
17 / 100
82 ms 1672 KB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,pas,pas1,pas2,z,x,tes,t,n,m,zx,xc;
char ch[1009][1009];
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>tes;
    for(t=1; t<=tes; t++){
    cin>>n>>m;
    z=m/2+1;
    if(n>=m){
        pas=n;
        pas1=n;
        pas2=0;
    }else{
        pas=m;
        pas1=0;
        pas2=m;
    }
    for(x=0; x<=n; x++){
        for(a=m; a>=1; a--){
            c=z-(m-a);zx=c*x;
            if(c<0) continue;
            //zx=x*z-(m-a)*x;
            if(zx%a!=0) xc=1; else xc=0;
            xc+=zx/a;
            //cout<<x<<" "<<a<<" "<<xc<<endl;
            if(xc<=n-n/2-1){
                if(pas<a+x){
                    pas=a+x;
                    pas1=x;
                    pas2=a;
                }
            }
        }
    }
    for(i=1; i<=n; i++){
        for(j=1; j<=m; j++) ch[i][j]='-';
    }
    cout<<pas<<endl;
    //cout<<pas1<<" "<<pas2<<endl;
    j=1;
    a=pas2;
    for(i=1; i<=pas1; i++){
        for(ii=1; ii<=z-(m-a); ii++){
            ch[i][j]='+';
            j++;
            if(j>a+1) j=1;
        }
        for(ii=a+1; ii<=m; ii++) ch[i][ii]='+';
    }
    for(i=1; i<=n; i++){
        for(j=1; j<=m; j++){
            cout<<ch[i][j];
        }
        cout<<endl;
    }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 384 KB in the table A+B is not equal to 28
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Incorrect 10 ms 384 KB in the table A+B is not equal to 28
# 결과 실행 시간 메모리 Grader output
1 Incorrect 82 ms 1672 KB in the table A+B is not equal to 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 62 ms 1516 KB in the table A+B is not equal to 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Incorrect 10 ms 384 KB in the table A+B is not equal to 28