# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599283 | 2022-07-19T12:21:30 Z | M_W | Red-blue table (IZhO19_stones) | C++17 | 2000 ms | 10316 KB |
#include <bits/stdc++.h> using namespace std; int a[1010][1010]; int main(){ int T; scanf("%d", &T); vector<vector<int>> v; v.push_back({0}); v.push_back({1}); for(int i = 1; i < 16; i++){ vector<vector<int>> tmp = v; v.clear(); for(auto t : tmp){ vector<int> tt = t; tt.push_back(0); v.push_back(tt); tt.pop_back(); tt.push_back(1); v.push_back(tt); } } while(T--){ int N, M, state = 0; scanf("%d %d", &N, &M); vector<int> ans; int mx = 0; for(auto x : v){ for(int i = 0; i < N; i++){ for(int j = 0; j < M; j++){ a[i][j] = x[(i * M) + j]; } } int cnt = 0; for(int i = 0; i < N; i++){ int red = 0, blue = 0; for(int j = 0; j < M; j++){ if(a[i][j]) red++; else blue++; } if(red > blue) cnt++; } for(int j = 0; j < M; j++){ int red = 0, blue = 0; for(int i = 0; i < N; i++){ if(a[i][j]) red++; else blue++; } if(blue > red) cnt++; } if(cnt > mx){ mx = cnt; ans = x; } } printf("%d\n", mx); for(int i = 0; i < N; i++){ for(int j = 0; j < M; j++){ printf(ans[(i * M) + j] ? "+" : "-"); } printf("\n"); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 10268 KB | Output is correct |
2 | Correct | 77 ms | 10316 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2070 ms | 10260 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 10268 KB | Output is correct |
2 | Correct | 77 ms | 10316 KB | Output is correct |
3 | Execution timed out | 2070 ms | 10260 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2025 ms | 10304 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2062 ms | 10268 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 10268 KB | Output is correct |
2 | Correct | 77 ms | 10316 KB | Output is correct |
3 | Execution timed out | 2070 ms | 10260 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |