Submission #1093907

#TimeUsernameProblemLanguageResultExecution timeMemory
1093907KasymKRed-blue table (IZhO19_stones)C++17
0 / 100
43 ms1504 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} void solve(int green_flecks){ int n, m; scanf("%d%d", &n, &m); bool ok = 0; if(n < m){ swap(n, m); ok = 1; } vector<vector<int>> A(n, vector<int> (m, 1)); int answer = n; int cnt = 0, x = 0; for(int ad = 0; ad < (m-1)>>1; ++ad) for(int i = 0; i < n; ++i){ A[i][x] = 0, cnt++; if(cnt == (n>>1)+1) x++, answer++, cnt = 0; } printf("%d\n", answer); if(ok){ for(int i = 0; i < n; ++i) for(int j = 0; j < m; ++j) A[i][j] ^= 1; for(int j = 0; j < m; ++j){ for(int i = 0; i < n; ++i) printf("%d", A[i][j]); puts(""); } return; } for(int i = 0; i < n; ++i){ for(int j = 0; j < m; ++j) printf("%d", A[i][j]); puts(""); } } int main(){ int tt; scanf("%d", &tt); while(tt--) solve(tt); return 0; }

Compilation message (stderr)

stones.cpp: In function 'void solve(int)':
stones.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
stones.cpp: In function 'int main()':
stones.cpp:54:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |     scanf("%d", &tt);
      |     ~~~~~^~~~~~~~~~~
#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...