답안 #674022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674022 2022-12-22T15:18:35 Z Vahe Red-blue table (IZhO19_stones) C++17
0 / 100
18 ms 1376 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool frrrrrrrrrrrrrrrrrrrrrr;

int ydonc_qanaky(vector<string>& v)
{
    int ret = 0;
    int c = 0;
    for (string& s : v) { for (char& ch : s) c += (ch == (frrrrrrrrrrrrrrrrrrrrrr ? '-' : '+')); ret += 2 * c > s.size(); c = 0; }

    for (int j = 0; j < v[0].size(); j++)
    {
        for (int i = 0; i < v.size(); i++) c += v[i][j] == (!frrrrrrrrrrrrrrrrrrrrrr ? '-' : '+');
        ret += 2 * c > v.size();
        c = 0;
    }
    return ret;
}

void solve() {
    frrrrrrrrrrrrrrrrrrrrrr = 0;
    int h, w; cin >> h >> w; if (h < w) swap(h, w), frrrrrrrrrrrrrrrrrrrrrr = 1;
    string s = string((w + 1 - frrrrrrrrrrrrrrrrrrrrrr) / 2, '+');
    s += string(w - s.size(), '-');
    vector<string> ans(h, s);
    
    int hm = (h + 1) / 2, wm = (w + 1 - frrrrrrrrrrrrrrrrrrrrrr) / 2;

    for (int i = 0; i < h; i++)
    {
        int h_ = i, w_ = i / hm;
        if (w_ + wm >= w) break;
        swap(ans[h_][w_], ans[h_][w_ + wm]);
    }
    cout << ydonc_qanaky(ans) << endl;
    if (frrrrrrrrrrrrrrrrrrrrrr)
    {
        for (int j = w - 1; j >= 0; j--)
        {
            for (int i = 0; i < h; i++) cout << ans[i][j];
            cout << '\n';
        }
    }
    else for(string & s : ans) cout << s + "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t; cin >> t; while(t--)
    solve();
}

Compilation message

stones.cpp: In function 'int ydonc_qanaky(std::vector<std::__cxx11::basic_string<char> >&)':
stones.cpp:10:111: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (string& s : v) { for (char& ch : s) c += (ch == (frrrrrrrrrrrrrrrrrrrrrr ? '-' : '+')); ret += 2 * c > s.size(); c = 0; }
      |                                                                                                         ~~~~~~^~~~~~~~~~
stones.cpp:12:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (int j = 0; j < v[0].size(); j++)
      |                     ~~^~~~~~~~~~~~~
stones.cpp:14:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for (int i = 0; i < v.size(); i++) c += v[i][j] == (!frrrrrrrrrrrrrrrrrrrrrr ? '-' : '+');
      |                         ~~^~~~~~~~~~
stones.cpp:15:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         ret += 2 * c > v.size();
      |                ~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 328 KB Wrong answer in test 2 4: 0 < 4
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Wrong answer in test 20 2: 0 < 20
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 328 KB Wrong answer in test 2 4: 0 < 4
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 1364 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1376 KB Wrong answer in test 24 24: 10 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 328 KB Wrong answer in test 2 4: 0 < 4
3 Halted 0 ms 0 KB -