# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
219412 |
2020-04-05T09:30:57 Z |
Vimmer |
Skandi (COCI20_skandi) |
C++14 |
|
10000 ms |
384 KB |
#include <bits/stdc++.h>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 75005
#define M ll(1e9 + 7)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef short int si;
int main()
{
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
string s[n];
for (int i = 0; i < n; i++) cin >> s[i];
vector <pair <int, int> > g; g.clear();
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (s[i][j] == '1' && ((i + 1 != n && s[i + 1][j] == '0') || (j + 1 != m && s[i][j + 1] == '0'))) g.pb({i, j});
int ans = 1e9;
vector <pair <pair <int, int>, int> > gr; gr.clear();
for (int umsk = 0; umsk < (1 << sz(g)); umsk++)
{
if (__builtin_popcount(umsk) > ans) continue;
vector <int> pr; pr.clear();
for (int i = 0; i < sz(g); i++) if ((1 << i) & umsk) pr.pb(i);
for (int msk = 0; msk < (1 << sz(pr)); msk++)
{
bool gd = 1;
bool mk[n][m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) mk[i][j] = s[i][j] - '0';
for (int i = 0; i < sz(pr); i++)
if ((1 << i) & msk)
{
int x = g[pr[i]].F, y = g[pr[i]].S;
if (y + 1 == m || s[x][y + 1] == '1') {gd = 0; break;}
int j = y + 1;
while (j < m && s[x][j] == '0') {mk[x][j] = 1; j++;}
}
else
{
int x = g[pr[i]].F, y = g[pr[i]].S;
if (x + 1 == n || s[x + 1][y] == '1') {gd = 0; break;}
int j = x + 1;
while (j < n && s[j][y] == '0') {mk[j][y] = 1; j++;}
}
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) if (!mk[i][j]) gd = 0;
if (gd)
{
ans = sz(pr);
gr.clear();
for (int i = 0; i < sz(pr); i++) gr.pb({{g[pr[i]].F, g[pr[i]].S}, (1 << i) & msk});
break;
}
}
}
cout << sz(gr) << endl;
for (auto it : gr) cout << it.F.F + 1 << " " << it.F.S + 1 << " " << (it.S == 1 ? "DESNO" : "DOLJE") << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
2 |
Correct |
4 ms |
384 KB |
Correct. |
3 |
Partially correct |
5 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
4 |
Correct |
5 ms |
384 KB |
Correct. |
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 |
Correct |
5 ms |
384 KB |
Correct. |
8 |
Partially correct |
4 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 |
Correct |
4 ms |
384 KB |
Correct. |
11 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
12 |
Correct |
5 ms |
384 KB |
Correct. |
13 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
14 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
15 |
Partially correct |
4 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 |
Correct |
4 ms |
384 KB |
Correct. |
18 |
Correct |
4 ms |
384 KB |
Correct. |
19 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
20 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
21 |
Correct |
4 ms |
384 KB |
Correct. |
22 |
Partially correct |
4 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. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
10041 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
2 |
Correct |
4 ms |
384 KB |
Correct. |
3 |
Partially correct |
5 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
4 |
Correct |
5 ms |
384 KB |
Correct. |
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 |
Correct |
5 ms |
384 KB |
Correct. |
8 |
Partially correct |
4 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 |
Correct |
4 ms |
384 KB |
Correct. |
11 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
12 |
Correct |
5 ms |
384 KB |
Correct. |
13 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
14 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
15 |
Partially correct |
4 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 |
Correct |
4 ms |
384 KB |
Correct. |
18 |
Correct |
4 ms |
384 KB |
Correct. |
19 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
20 |
Partially correct |
4 ms |
384 KB |
First line is correct, but the reconstruction is not properly formatted. |
21 |
Correct |
4 ms |
384 KB |
Correct. |
22 |
Partially correct |
4 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 |
Execution timed out |
10041 ms |
384 KB |
Time limit exceeded |
25 |
Halted |
0 ms |
0 KB |
- |