# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94137 | talip | Prosjecni (COCI16_prosjecni) | C++14 | 3 ms | 416 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n, vec[103][103];
int main(){
ios::sync_with_stdio(false); cin >> n;
if(n==2){
cout << -1; return 0;
}
int num=vec[0][n-1]=n*(n-1)/2;
for(int i=0;n-1>i;++i){
vec[0][i]=i+1;
}
for(int i=1;n>i;i++){
for(int j=0;n>j;j++){
vec[i][j]=vec[i-1][j]+num;
}
}
for(int i=0;n>i;i++){
vec[n-1][i]=n*vec[n-2][i];
for(int j=0;n-1>j;j++){
vec[n-1][i]-=vec[j][i];
}
}
for(int i=0;n>i;i++){
for(int j=0;n>j;j++){
cout << vec[i][j] << " ";
}
cout << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |