# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
219398 | 2020-04-05T08:46:31 Z | VEGAnn | Skandi (COCI20_skandi) | C++14 | 6 ms | 768 KB |
#include <bits/stdc++.h> #define all(x) x.begin(),x.end() #define sz(x) ((int)x.size()) #define PB push_back #define pii pair<int,int> #define MP make_pair #define ft first #define sd second using namespace std; const int N = 510; const int K = 1520; const int oo = 2e9; const int md = int(1e9) + 7; vector<pii> vc; char c[N][N], cc[N][N]; int n, m, ans = oo, mem; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); // freopen("in.txt","r",stdin); cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> c[i][j]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++){ if (c[i][j] == '0') continue; if (i < n - 1 && c[i + 1][j] == '0') vc.PB(MP(i * m + j, 0)); if (j < m - 1 && c[i][j + 1] == '0') vc.PB(MP(i * m + j, 1)); } for (int msk = 0; msk < (1 << sz(vc)); msk++){ int kol = __builtin_popcount(msk); if (kol >= ans) continue; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cc[i][j] = c[i][j]; for (int id = 0; id < sz(vc); id++) if (msk & (1 << id)){ int x = vc[id].ft / m; int y = vc[id].ft % m; if (vc[id].sd){ int yy = y + 1; while (yy < m && c[x][yy] == '0'){ cc[x][yy] = '1'; yy++; } } else { int xx = x + 1; while (xx < n && c[xx][y] == '0'){ cc[xx][y] = '1'; xx++; } } } bool ok = 1; for (int i = 0; i < n && ok; i++) for (int j = 0; j < m && ok; j++) if (cc[i][j] == '0') ok = 0; if (ok && ans > kol){ ans = kol; mem = msk; } } cout << ans << '\n'; return 0; }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
2 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
3 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
4 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
5 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
6 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
7 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
8 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
9 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
10 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
11 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
12 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
13 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
14 | Partially correct | 6 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
15 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
16 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
17 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
18 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
19 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
20 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
21 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
22 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
23 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 768 KB | First line is not correct. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
2 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
3 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
4 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
5 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
6 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
7 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
8 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
9 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
10 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
11 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
12 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
13 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
14 | Partially correct | 6 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
15 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
16 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
17 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
18 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
19 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
20 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
21 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
22 | Partially correct | 5 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
23 | Partially correct | 4 ms | 384 KB | First line is correct, but the reconstruction is not properly formatted. |
24 | Incorrect | 6 ms | 768 KB | First line is not correct. |
25 | Halted | 0 ms | 0 KB | - |