Submission #171289

#TimeUsernameProblemLanguageResultExecution timeMemory
171289makotakoKocka (COCI18_kocka)C++14
70 / 70
233 ms8228 KiB
#include<bits/stdc++.h> #define ll long long #define F first #define S second #define pb push_back #define pp pop_back #define in insert #define pii pair<int, int> #define pll pair<ll, ll> #define N int(1e5) + 5 #define T int(1e4) + 55 #define H int(1e3) + 55 using namespace std; ll n, l[N], r[N], u[N], d[N], q[N], w[N], e[N], sum, num, sam, nam, used[N], used1[N]; int main() { cin >> n; for(int i = 1;i <= n; ++ i) { e[i] = 1e9; q[i] = 1e9; w[i] = 1e9; } for(int i = 1;i <= n; ++ i) { cin >> l[i]; if(l[i] == -1) { used[i] = 1; } else { q[1 + l[i]] = i - 1; w[1 + l[i]] = n - i; e[i] = n - l[i] - 1; } } for(int i = 1;i <= n; ++ i) { cin >> r[i]; if(r[i] == -1) { used[i] = 1; } else { num = i - 1; q[n - r[i]] = min(num, q[n - r[i]]); w[n - r[i]] = min(w[n - r[i]], n - i); } if(e[i] < r[i] || r[i] == -1 && e[i] != 1e9) { sum = 1; } } for(int i = 1;i <= n; ++ i) { cin >> u[i]; if(used[1 + u[i]] == 1 || q[i] < u[i] || q[i] != 1e9 && u[i] == -1) { sum = 2; } if(u[i] != -1) w[i] = min(w[i], n - u[i] - 1); } for(int i = 1;i <= n; ++ i) { cin >> d[i]; if(used[n - d[i]] == 1 || u[i] == -1 && d[i] != -1 || d[i] == -1 && w[i] != 1e9 || w[i] < d[i]) { sum = 3; } } if(sum == 0) { cout << "DA"; } else { cout << "NE"; } }

Compilation message (stderr)

kocka.cpp: In function 'int main()':
kocka.cpp:47:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if(e[i] < r[i] || r[i] == -1 && e[i] != 1e9) {
                       ~~~~~~~~~~~^~~~~~~~~~~~~~
kocka.cpp:53:56: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(used[1 + u[i]] == 1 || q[i] < u[i] || q[i] != 1e9 && u[i] == -1) {
                                            ~~~~~~~~~~~~^~~~~~~~~~~~~
kocka.cpp:61:42: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if(used[n - d[i]] == 1 || u[i] == -1 && d[i] != -1 || d[i] == -1 && w[i] != 1e9 || w[i] < d[i]) {
                               ~~~~~~~~~~~^~~~~~~~~~~~~
kocka.cpp:61:70: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if(used[n - d[i]] == 1 || u[i] == -1 && d[i] != -1 || d[i] == -1 && w[i] != 1e9 || w[i] < d[i]) {
                                                           ~~~~~~~~~~~^~~~~~~~~~~~~~
#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...