Submission #674023

#TimeUsernameProblemLanguageResultExecution timeMemory
674023VaheRed-blue table (IZhO19_stones)C++17
0 / 100
15 ms1488 KiB
#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 - 2 * frrrrrrrrrrrrrrrrrrrrrr) / 2, '+'); s += string(w - s.size(), '-'); vector<string> ans(h, s); int hm = (h + 1) / 2, wm = (w + 1 - 2 * 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 (stderr)

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();
      |                ~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...