Submission #237133

#TimeUsernameProblemLanguageResultExecution timeMemory
237133VimmerVođe (COCI17_vode)C++14
0 / 120
275 ms392312 KiB
#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]) f[i - 1][j - 1] = (f[i - 1][j - 1] == -1 ? f[i][j] : f[i - 1][j - 1] | f[i][j]); else f[i - 1][j - 1] = (f[i - 1][j - 1] == -1 ? (1 + f[i][j]) % 2 : f[i - 1][j - 1] | (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 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...