# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
237129 |
2020-06-04T17:46:32 Z |
Vimmer |
Vođe (COCI17_vode) |
C++14 |
|
3000 ms |
392316 KB |
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#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 50001
#define M ll(1e9 + 7)
#define inf 1e9 + 1e9
using namespace std;
//using namespace __gnu_pbds;
typedef long double ld;
typedef long long ll;
typedef short int si;
typedef array <int, 2> a2;
//typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int f[10005][10005];
int main()
{
//freopen("input.txt", "r", stdin); //freopen("output4.txt", "w", stdout);
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m, k;
cin >> n >> m >> k;
int nm = n + m;
int a[nm];
int j = 0;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = n; i < nm; i++) a[i] = a[j++];
memset(f, -1, sizeof(f));
for (int i = 0; i < nm; i++) f[i][m - 1] = 0;
for (int i = nm - 1; i > 0; i--)
for (int j = m - 1; j >= 0; j--)
{
if (f[i][j] == -1) continue;
if (a[i - 1] == a[i])
for (int u = j - 1; u >= max(0, j - k); u--) f[i - 1][u] = (f[i - 1][u] == -1 ? f[i][j] : f[i - 1][u] | f[i][j]);
else
for (int u = j - 1; u >= max(0, j - k); u--) f[i - 1][u] = (f[i - 1][u] == -1 ? (1 + f[i][j]) % 2 : f[i - 1][u] | (1 + f[i][j]) % 2);
}
for (int i = 0; i < n; i++)
if (f[i][0]) cout << a[i] << " "; else cout << (1 + a[i]) % 2 << " ";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
194 ms |
392056 KB |
Output is correct |
2 |
Correct |
195 ms |
392184 KB |
Output is correct |
3 |
Correct |
196 ms |
392184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
195 ms |
392136 KB |
Output is correct |
2 |
Correct |
200 ms |
392184 KB |
Output is correct |
3 |
Correct |
228 ms |
392316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
203 ms |
392184 KB |
Output is correct |
2 |
Correct |
220 ms |
392184 KB |
Output is correct |
3 |
Correct |
201 ms |
392056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
212 ms |
392056 KB |
Output is correct |
2 |
Correct |
232 ms |
392056 KB |
Output is correct |
3 |
Correct |
198 ms |
392184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
211 ms |
392184 KB |
Output is correct |
2 |
Correct |
220 ms |
392184 KB |
Output is correct |
3 |
Correct |
270 ms |
392040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
392184 KB |
Output is correct |
2 |
Correct |
231 ms |
392184 KB |
Output is correct |
3 |
Correct |
199 ms |
392056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
359 ms |
392192 KB |
Output is correct |
2 |
Correct |
1739 ms |
392184 KB |
Output is correct |
3 |
Execution timed out |
3105 ms |
392184 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2448 ms |
392184 KB |
Output is correct |
2 |
Execution timed out |
3112 ms |
392184 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3109 ms |
392184 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3099 ms |
392188 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |