답안 #991562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991562 2024-06-02T12:59:00 Z Mardonbekhazratov Red-blue table (IZhO19_stones) C++17
27 / 100
63 ms 1364 KB
#include<bits/stdc++.h>
using namespace std;

void solve(){
    int n,m;
    cin>>n>>m;
    vector<string>a;
    if(n>=m){
        a.assign(n,string(m,'+'));
        vector<int>b(n,0);
        for(int i=0;i<m;i++){
            set<pair<int,int>>s;
            for(int j=0;j<n;j++) s.insert({b[j],j});
            for(int j=0;j<n/2+1;j++){
                auto x=*s.begin();
                s.erase(s.begin());
                if(x.first>=(m-1)/2) break;
                b[x.second]++;
                a[x.second][i]='-';
            }
        }
    }
    else{
        a.assign(n,string(m,'-'));
        vector<int>b(m,0);
        for(int i=0;i<n;i++){
            set<pair<int,int>>s;
            for(int j=0;j<m;j++) s.insert({b[j],j});
            for(int j=0;j<m/2+1;j++){
                auto x=*s.begin();
                s.erase(s.begin());
                if(x.first>=(n-1)/2) break;
                b[x.second]++;
                a[i][x.second]='+';
            }
        }
    }
    cout<<max(n,m)+(min(n,m)-1)/2<<'\n';
    for(int i=0;i<n;i++){
        cout<<a[i]<<'\n';
    }
}

signed main(){
    int t=1;
    cin>>t;
    while(t--){
        solve();
        cout<<'\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 348 KB in the table A+B is not equal to 31
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 50 ms 1360 KB in the table A+B is not equal to 107
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 1364 KB in the table A+B is not equal to 35
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 348 KB in the table A+B is not equal to 31
5 Halted 0 ms 0 KB -