Submission #879793

#TimeUsernameProblemLanguageResultExecution timeMemory
879793binh192004Kocka (COCI18_kocka)C++17
70 / 70
247 ms17116 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count()); #define int long long #define double long double #define all(x) (x).begin(), (x).end() #define pii pair<int, int> #define lowbit(x) x & (-x); #define inf 1e18 #define _inf -1e18 #define pyes cout << "YES" << endl #define pno cout << "NO" << endl #define inv(a) for (int& x: a) cin >> x; #define llv(a) for (ll& x: a) cin >> x; #define pri(a) for (int& x: a) cout << x << ' ' int const MOD = 998244353; int const lg = 20; int const block = 500; // int block; int const MAX = 1e3 + 1, N = 20; int n, m, q, k, p; int a[25][25]; bool Work(vector<int> l, vector<int> r, vector<int> t, vector<int> b){ map<int, int> fortop, forbot; for (int i = n - 1; i >= 0; i--){ fortop[t[i]] = i; forbot[b[i]] = i; } // cout << n << '\n'; for (int i = 0; i < n; i++){ int lef = l[i]; int rig = r[i]; if (lef == -1){ // cout << i << '\n'; if (rig != -1) return false; if (fortop.find(i) != fortop.end()) return false; if (forbot.find(n - i - 1) != forbot.end()) return false; } else{ if (rig == -1 || rig + lef >= n) return false; if (fortop.find(i) != fortop.end() && fortop[i] < lef - 1) return false; if (forbot.find(n - i - 1) != forbot.end() && forbot[n - i - 1] < lef - 1) return false; } // return true; } return true; } void bexuyen67() { cin >> n; vector<int> l(n); auto r = l; auto t = l; auto b = l; inv(l) inv(r) inv(t) inv(b) bool ck = 1; ck &= Work(l, r, t, b); reverse(all(t)); reverse(all(b)); ck &= Work(r, l, t, b); ck &= Work(t, b, r, l); reverse(all(l)); reverse(all(r)); ck &= Work(b, t, r, l); cout << (ck ? "DA" : "NE"); } signed main() { #ifdef binhball freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cin.tie(0)->sync_with_stdio(0); cout << fixed << setprecision(15); int t = 1; // cin >> t; while (t--) bexuyen67(); }
#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...