답안 #96486

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96486 2019-02-09T16:37:49 Z karlopuh Kocka (COCI18_kocka) C++14
28 / 70
79 ms 66560 KB
#include <bits/stdc++.h>
using namespace std;

bool moze=true;
int n;
vector<vector<int> > polje;

int main(){
	cin>>n;
	vector<int> pom;
	for(int i=0;i<n;i++){
		polje.push_back(pom);
		int a;
		cin>>a;
		if(a==-1){
			polje[i].insert(polje[i].begin(),n,0);
		}else if(a==0){
			polje[i].push_back(1);
			polje[i].insert(polje[i].end(),n-1,-1);
		}else{
			polje[i].insert(polje[i].begin(),a,0);
			polje[i].push_back(1);
			polje[i].insert(polje[i].end(),n-a-1,-1);
		}
	}
	
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(a==-1){
			if(polje[i][n-1]!=0){
				moze=false;
				
			}
		}else if(a==0){
			if(polje[i][n-1]==0){
				moze=false;
				
			}
			polje[i][n-1]=1;
		}else{
			for(int k=n-1;k>n-a-1;k--){
				if(polje[i][k]==1){
					moze=false;
					
				}
				polje[i][k]=0;
			}
			if(polje[i][n-a-1]==0){
				moze=false;
				
			}
			polje[i][n-a-1]=1;
		}
		
		
	}
	
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(a==-1){
			if(polje[0][i]!=0){
				moze=false;
				
			}
		}else if(a==0){
			if(polje[0][i]==0){
				moze=false;
				
			}
			polje[0][i]=1;
		}else{
			for(int k=0;k>a;k++){
				if(polje[k][i]==1){
					moze=false;
					
				}
				polje[k][i]=0;
			}
			if(polje[a][i]==0){
				moze=false;
				
			}
			polje[a][i]=1;
		}
		
		
	}
	
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(a==-1){
			if(polje[n-1][i]!=0){
				moze=false;
				
			}
		}else if(a==0){
			if(polje[n-1][i]==0){
				moze=false;
				
			}
			polje[n-1][i]=1;
		}else{
			for(int k=n-1;k>n-a-1;k--){
				if(polje[k][i]==1){
					moze=false;
					
				}
				polje[k][i]=0;
			}
			if(polje[n-a-1][i]==0){
				moze=false;
				
			}
			polje[n-a-1][i]=1;
		}
		
		
	}
	
	if(moze)cout<<"DA";
	else cout<<"NE";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 5240 KB Output is correct
2 Correct 6 ms 4344 KB Output is correct
3 Correct 9 ms 5240 KB Output is correct
4 Correct 8 ms 4216 KB Output is correct
5 Correct 9 ms 5240 KB Output is correct
6 Correct 6 ms 4216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 5240 KB Output is correct
2 Correct 6 ms 4344 KB Output is correct
3 Correct 10 ms 5240 KB Output is correct
4 Correct 6 ms 4216 KB Output is correct
5 Correct 12 ms 5240 KB Output is correct
6 Correct 6 ms 4220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 79 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 61 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 64 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -