# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
147025 | lovro_nidogon1 | Prosjecni (COCI16_prosjecni) | C++14 | 3 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, x, y, z, by;
cin >> n;
if(n == 2) {
cout << -1;
return 0;
}
if(n%2 == 0) {
x = 0;
by = 0;
for(int i = 0; i < n; i++) {
y = 0;
if(i == n - 2) {
z = x + 1;
}
if(i == n - 1) {
x = (z * n) - by - 1;
}
by = by + x + 1;
for(int j = 0; j < n - 1; j++) {
x++;
y = y + x;
cout << x << " ";
}
cout << (x * n) - y << '\n';
x = (x * n) - y;
}
} else {
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
x++;
cout << x << " ";
}
cout << endl;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |