1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
| #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[4] = {-1, 0, 1, 0};
int dx[4] = { 0, 1, 0, -1};
vector< int > v[5005][5005];
const int GETA = 1000;
int N = 0;
void dfs(int y, int x, int dir, int c) {
if(c == N) return;
int n = v[y][x].size();
v[y][x].push_back(c);
int ndir = 0;
if(n % 2 == 0) {
ndir = (dir + 1) % 4;
} else {
ndir = (dir + 3) % 4;
}
int ny = y + dy[ndir];
int nx = x + dx[ndir];
dfs(ny, nx, ndir, c+1);
return;
}
void print(int x) {
REP(i, GETA-x, GETA+x+1) {
REP(j, GETA-x, GETA+x+1) {
cout << v[i][j].size() << " ";
}
cout << endl;
}
}
void print2(int x) {
REP(i, GETA-x, GETA+x+1) {
REP(j, GETA-x, GETA+x+1) {
if(v[i][j].size() % 2 == 0) {
cout << " ";
} else {
cout << "O";
}
}
cout << endl;
}
}
int main() {
vector<int> t;
rep(k, 10) {
N = k * 100 + 10000;
rep(i, 2005) rep(j, 2005) v[i][j].clear();
dfs(GETA, GETA, 0, 0);
ll cnt = 0;
rep(i, 5005) {
rep(j, 5005) {
if(v[i][j].size() % 2 == 1) {
cnt++;
}
}
}
t.push_back(cnt);
cout << cnt << endl;
}
rep(i, t.size()-1) {
cout << t[i+1] - t[i] << " ";
}
cout << endl;
return 0;
}
|