Submission #87188

#TimeUsernameProblemLanguageResultExecution timeMemory
87188jvalsortavKocka (COCI18_kocka)C++14
28 / 70
12 ms6820 KiB
#include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <cctype> #include <ctime> #include <utility> #include <set> using namespace std; int n, x; int square1[1010][1010], square2[1010][1010]; long long l[1010], r[1010], u[1010], d[1010]; bool inf = true; int main() { cin >> n; for (int i = 0; i < n; i++){ cin >> x; l[i] = x; // ljevo if (x == -1) continue; else{ square1[i][x] = 1; } } for (int i = 0; i < n; i++){ cin >> r[i]; // desno } /*cout << endl; for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ cout << square1[i][j] << " "; } cout << endl; } cout << endl;*/ for (int i = 0; i < n; i++){ cin >> x; u[i] = x; // gore if (x == -1) continue; else{ square2[x][i] = 1; } } /*cout << endl; for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ cout << square2[i][j] << " "; } cout << endl; }*/ for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ if (square1[i][j] or square2[i][j]) square1[i][j] = 1; } } for (int i = 0; i < n; i++){ cin >> x; // dolje if (x == -1) x = n; for (int j = n-1; j > n-x; j--){ if (square1[j][i]){ /*cout << j << " " << i << endl;*/ inf = false; break; } } if (!inf) break; } if (inf){ for (int i = 0; i < n; i++){ x = r[i]; // desno if (x == -1) x = n; for (int j = n-1; j > n-x; j--){ if (square1[i][j]){ inf = false; break; } } if (!inf) break; } if (inf){ for (int i = 0; i < n; i++){ x = u[i]; // gore if (x == -1) x = n; for (int j = 0; j < x; j++){ if(square1[j][i]){ inf = false; break; } } if (!inf) break; } if (inf){ for (int i = 0; i < n; i++){ x = l[i]; // ljevo if (x == -1) x = n; for (int j = 0; j < x; j++){ if (square1[i][j]){ inf = false; break; } } } } } } /*cout << endl; for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ cout << square1[i][j] << " "; } cout << endl; }*/ if (inf) cout << "DA"; else cout << "NE"; return 0; }
#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...