Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int row[100005], column[100005];
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- int n;
- cin >> n;
- for(int i = 0; i < 4; i++){
- for(int j = 0; j < n; j++){
- int inp;
- cin >> inp;
- if(i == 0){
- if(inp == -1){
- row[j] = -1;
- continue;
- }
- row[j] = 1;
- column[inp] = 1;
- }
- else if(i == 1){
- if(inp == -1){
- if(row[j] == 1) return cout << "NE",0;
- continue;
- }
- else if(row[j] == -1 || column[n - inp - 1] == -1) return cout << "NE",0;
- row[j] = 1;
- column[n - inp - 1] = 1;
- }
- else if(i == 2){
- if(inp == -1){
- if(column[j] == 1) return cout << "NE",0;
- continue;
- }
- else if(column[j] == -1 || row[inp] == -1) return cout << "NE",0;
- row[inp] = 1;
- column[j] = 1;
- }
- else if(i == 3){
- if(inp == -1){
- if(column[j] == 1) return cout << "NE",0;
- continue;
- }
- else if(column[j] == -1 || row[n - inp - 1] == -1) return cout << "NE",0;
- row[n - inp - 1] = 1;
- column[j] = 1;
- }
- }
- }
- cout << "DA";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement