답안 #328998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
328998 2020-11-18T17:16:24 Z Traduttore Red-blue table (IZhO19_stones) C++14
0 / 100
48 ms 1388 KB
 #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define F first
#define S second
#define ld long double
#define ll long long
#define endl '\n'
#define pll pair <ll,ll>
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define TIME 1.0*clock()/CLOCKS_PER_SEC
using namespace std;
using namespace __gnu_pbds;
mt19937_64 gen(time(NULL));
typedef tree <ll,null_type,less <ll>,rb_tree_tag,tree_order_statistics_node_update> orduk;
typedef tree <pll,null_type,less <pll>,rb_tree_tag,tree_order_statistics_node_update> orduk2;
//typedenf tree <vector <orduk2>,null_type,less <>,rb_tree_tag,tree_order_statistics_node_update> orduk2;
ll t;
ll n,m;
void init() {
    cin>>t;
}
vector <vector <char> > a;
ll ans = 0;
void output() {
    cout<<ans<<'\n';
    for (int i = 0;i < n;i++)
    {
        for (int j = 0;j < m;j++)
        {
            cout<<a[i][j];
        }
        cout<<'\n';
    }
}
void solve() {
    while (t--)
    {
        cin>>n>>m;
        a.clear();
        a.resize(n,vector <char> (m));
        int p1 = -1;
        int p2 = -1;
        for (int i = 0;i < n;i++)
        {
            for (int j = 0;j < m;j++)
            {
                a[i][j] = '+';
            }
        }
        vector <int> kol(m);
        ans = n;
        ll vz = 0;
        for (int i = 0;i < n;i++)
        {
            for (int j = 0;j < m;j++)
            {
                ll cur = n - i - (j >= (m / 2) - (!(m % 2)));
                ++kol[j];
                if (kol[j] == (n / 2) + (n % 2)) ++vz;
                cur+=vz;
                ans = max(ans,cur);
                if (ans==cur) p1 = i,p2 = j;
            }
        }
        for (int i = 0;i <= p1;i++)
        {
            for (int j = 0;j < m;j++)
            {
                if (i!=p1) a[i][j] = '-';
                else if (i==p1 && j <= p2) a[i][j] = '-';
            }
        }
        output();
    }
    exit(0);
}
int main() {
    //freopen("repair.in","r",stdin);
    //freopen("repair.out","w",stdout);
IOS;
srand(time(NULL));
ll m;
m = 10;
m-=9;
while (m--)
{
    init();
    solve();
    output();
}
return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 0 ms 364 KB in the table A+B is not equal to 2
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 364 KB in the table A+B is not equal to 2
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 0 ms 364 KB in the table A+B is not equal to 2
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 1388 KB Wrong answer in test 97 21: 97 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 42 ms 1388 KB in the table A+B is not equal to 36
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 0 ms 364 KB in the table A+B is not equal to 2