제출 #146717

#제출 시각아이디문제언어결과실행 시간메모리
146717fabjanmProsjecni (COCI16_prosjecni)C++98
24 / 120
2 ms504 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...