Please sign in first.
Submission #71657753
Source Code Expand
#include <bits/stdc++.h>
//#include <windows.h>
//taskkill /f /im 未命名1.exe
#define ED cerr<<endl;
#define TS cerr<<"I AK IOI"<<endl;
#define cr(x) cerr<<x<<endl;
#define cr2(x,y) cerr<<x<<" "<<y<<endl;
#define cr3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<endl;
#define cr4(x,y,z,w) cerr<<x<<" "<<y<<" "<<z<<" "<<w<<endl;
#define pr(a,l,r) for(int i=l;i<=r;++i) cerr<<a[i]<<' ';ED
#define popcnt __builtin_popcount
#define all(s) s.begin(),s.end()
#define bstring basic_string
//#define add(x,y) (x+=y)%=mod
#define pii pair<int,int>
#define epb emplace_back
#define pb push_back
#define mk make_pair
#define ins insert
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
using namespace std;
const int N=105,INF=2e9,mod=1e9+7;
int t,n,m;
int a[N][N];
int main()
{
scanf("%d",&n);
int x,y;
a[x=0][y=(n-1)/2]=1;
for(int i=1,nw=2;i<=n*n-1;++i,++nw) {
if(!a[(x-1+n)%n][(y+1)%n]) {
a[x=(x-1+n)%n][y=(y+1)%n]=nw;
}
else a[x=(x+1)%n][y]=nw;
}
for(int i=0;i<n;++i) {
for(int j=0;j<n;++j) {
printf("%d ",a[i][j]);
}
puts("");
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Magic Square |
| User | Include_S_Z_C_ |
| Language | C++23 (GCC 15.2.0) |
| Score | 200 |
| Code Size | 1137 Byte |
| Status | AC |
| Exec Time | 2 ms |
| Memory | 4000 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3668 KiB |
| 00_sample_01.txt | AC | 1 ms | 3704 KiB |
| 01_test_00.txt | AC | 1 ms | 3728 KiB |
| 01_test_01.txt | AC | 1 ms | 3816 KiB |
| 01_test_02.txt | AC | 1 ms | 3784 KiB |
| 01_test_03.txt | AC | 1 ms | 3872 KiB |
| 01_test_04.txt | AC | 1 ms | 3784 KiB |
| 01_test_05.txt | AC | 1 ms | 3772 KiB |
| 01_test_06.txt | AC | 1 ms | 3796 KiB |
| 01_test_07.txt | AC | 1 ms | 3876 KiB |
| 01_test_08.txt | AC | 2 ms | 3832 KiB |
| 01_test_09.txt | AC | 1 ms | 3916 KiB |
| 01_test_10.txt | AC | 2 ms | 4000 KiB |