Submission #257099

#TimeUsernameProblemLanguageResultExecution timeMemory
257099BTheroRed-blue table (IZhO19_stones)C++17
15 / 100
13 ms1920 KiB
// chrono::system_clock::now().time_since_epoch().count() #include<bits/stdc++.h> #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; const int MAXN = (int)1e3 + 5; const int INF = (int)1e9; char s[MAXN][MAXN]; int cnt[MAXN]; int n, m; pii ans; void solve() { scanf("%d %d", &n, &m); ans = mp(m, 0); for (int i = 0; i < m; ++i) { cnt[i] = n; } for (int step = 1, ptr = 0, col = m; step <= n; ++step) { for (int i = 1; i <= m / 2 + 1; ++i) { if (--cnt[ptr] < n / 2 + 1) { --col; } ptr = (ptr + 1) % m; } ans = max(ans, mp(step + col, step)); } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { s[i][j] = '-'; } s[i][m] = '\0'; } for (int step = 1, ptr = 0; step <= ans.se; ++step) { for (int i = 1; i <= m / 2 + 1; ++i) { s[step - 1][ptr] = '+'; ptr = (ptr + 1) % m; } } printf("%d\n", ans.fi); for (int i = 0; i < n; ++i) { printf("%s\n", s[i]); } } int main() { int tt; scanf("%d", &tt); while (tt--) { solve(); } return 0; }

Compilation message (stderr)

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