Submission #146717

# Submission time Handle Problem Language Result Execution time Memory
146717 2019-08-25T14:14:11 Z fabjanm Prosjecni (COCI16_prosjecni) C++
24 / 120
2 ms 504 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int mat[105][105];

int kolko[1000000];

int main(){
	int n;
	cin>>n;
	
	if(n==1){
		cout<<-1;
		return 0;
	}
	
	if(n % 2 == 1){
		int br=2*n;
		int poc=n*10;
		for(int i=0;i<n;i++){
			mat[i][n/2+1]=poc;
			poc+=br*2;
		}
		for(int i=0;i<n;i++){
			int poc=mat[i][n/2+1];
			for(int j=0;j<n;j++){
				mat[i][j]=poc-2*(n/2-j);
				kolko[mat[i][j]]++;
			}
		}
		
		/*for(int i=0;i<10000;i++){
			if(kolko[i]>1){
				cout<<i<<endl;
				system("pause");
			}
		}*/
		
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cout<<mat[i][j]<<" ";
			}
			cout<<endl;
		}
	}
	else{
		cout<<-1;
		return 0;
		int br=2*n;
		int poc=n*10;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				
			}
		}
	}
	
	
	
	return 0;
}

Compilation message

prosjecni.cpp: In function 'int main()':
prosjecni.cpp:53:7: warning: unused variable 'br' [-Wunused-variable]
   int br=2*n;
       ^~
prosjecni.cpp:54:7: warning: unused variable 'poc' [-Wunused-variable]
   int poc=n*10;
       ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Integer -1 violates the range [0, 1000000000]
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 256 KB Integer -1 violates the range [0, 1000000000]
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Integer -1 violates the range [0, 1000000000]
6 Incorrect 2 ms 376 KB Integer -1 violates the range [0, 1000000000]
7 Incorrect 2 ms 376 KB Integer -1 violates the range [0, 1000000000]
8 Incorrect 2 ms 256 KB Integer -1 violates the range [0, 1000000000]
9 Incorrect 2 ms 376 KB Integer -1 violates the range [0, 1000000000]
10 Incorrect 2 ms 376 KB Integer -1 violates the range [0, 1000000000]