闲暇之余并没有好好补题而和小南瓜一起开了一场女生赛x
然而自己菜死了,没看清I的题目,还分析错了E的复杂度,导致最后只有9题
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 13:31:09
File Name :A.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkdfile() freopen("in.txt","w",stdout);
#define setlargestack(x) int _SIZE=x<<20;char *_PPP=(char*)malloc(_SIZE)+_SIZE;__asm__("movl %0, %%esp\n" :: "r"(_PPP));
#define read2(a,b) read(a),read(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define readg(_x1,_y1,_x2,_y2) read(_x1),read(_y1),read(_x2),read(_y2)
#define USE_CIN_COUT ios::sync_with_stdio(0)
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
namespace fastIO{
#define BUF_SIZE 100000
#define OUT_SIZE 100000
//fread->read
bool IOerror=0;
inline char nc(){
static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
if (pend==p1){IOerror=1;return -1;}
//{printf("IO error!\n");system("pause");for (;;);exit(0);}
}
return *p1++;
}
inline bool blank(char ch){return ch==32||ch==10||ch==13||ch==9;}
inline bool enter(char ch){return ch==10||ch==13;}
inline void read(int &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (sign)x=-x;
}
inline void read(ll &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (sign)x=-x;
}
inline void read(double &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (ch==46){
double tmp=1; ch=nc();
for (;ch>=48&&ch<=57;ch=nc())tmp/=10.0,x+=tmp*(ch-48);
}
if (sign)x=-x;
}
inline void read(char *s){
char ch=nc();
for (;blank(ch);ch=nc());
if (IOerror)return;
for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch;
*s=0;
}
inline void readln(char *s) {
char ch=nc();
for (;blank(ch);ch=nc());
if(IOerror)return;
for(;!enter(ch)&&!IOerror;ch=nc())*s++=ch;
*s=0;
}
inline void read(char &c){
for (c=nc();blank(c);c=nc());
if (IOerror){c=-1;return;}
}
#undef OUT_SIZE
#undef BUF_SIZE
}
using fastIO::read;
int main() {
int n;
scanf("%d",&n);
double sum = 0;
for(int i = 0;i < n;i++) {
int x;
scanf("%d",&x);
if(sum >= 100 && sum < 150) x *= 0.8;
else if(sum >= 150 && sum < 400) x *= 0.5;
sum += x;
}
printf("%.2f\n",sum);
return 0;
}
其实可以根号n的复杂度,但是实际上直接算sum然后枚举约数也是根号n复杂度(可以思考下为什么
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 13:53:50
File Name :B.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
ll n;
cin >> n;
ll sum = (n + 1) * n / 2;
for (ll i = 2; i * i <= sum; ++i)
if (sum % i == 0) {
cout << sum / i << '\n';
return 0;
}
return 0;
}
考虑最开始就分配好每个都是1,然后不足的部分慢慢+1挪过去,因为开口朝上的二次函数的delta y是递增的,所以是对的
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 16:28:30
File Name :C.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
int const N = 100005;
struct node {
int a, b, c;
ll calc(int x) {
return a * x * x + b * x + c;
}
} F[N];
int pr[N];
int main() {
USE_CIN_COUT;
int n, m;
cin >> n >> m;
ll ans = 0;
auto q = priority_queue<pli, vector<pli>, greater<pli>>();
for (int i = 1; i <= n; ++i) {
cin >> F[i].a >> F[i].b >> F[i].c;
ans += F[i].calc(1);
q.push(make_pair(F[i].calc(2) - F[i].calc(1), i));
pr[i] = 1;
}
m -= n;
while (m--) {
auto now = q.top();
q.pop();
ans += now.first;
auto i = now.second;
pr[i]++;
q.push(make_pair(F[i].calc(pr[i] + 1) - F[i].calc(pr[i]), i));
}
cout << ans << '\n';
return 0;
}
傻叉树剖
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 15:34:50
File Name :D.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int const N = 100005;
vector<int> G[N];
int a[N], n;
ll sum[N << 2];
bool flag[N << 2];
int id[N];
int ql, qr;
void build(int k, int l, int r) {
if (l == r) {
sum[k] = a[id[l]];
flag[k] = sum[k] == 1;
return;
}
int mid = (l + r) >> 1;
build(k << 1, l, mid);
build(k << 1 | 1, mid + 1, r);
sum[k] = sum[k << 1] + sum[k << 1 | 1];
flag[k] = flag[k << 1] & flag[k << 1 | 1];
}
void update(int k, int l, int r) {
if (l == r) {
sum[k] = sqrt(sum[k]);
if (sum[k] == 1)
flag[k] = 1;
return;
}
if (ql <= l && r <= qr && flag[k])
return;
int mid = (l + r) >> 1;
if (ql <= mid)
update(k << 1, l, mid);
if (qr > mid)
update(k << 1 | 1, mid + 1, r);
sum[k] = sum[k << 1] + sum[k << 1 | 1];
flag[k] = flag[k << 1] & flag[k << 1 | 1];
}
ll query(int k, int l, int r) {
if (ql <= l && r <= qr)
return sum[k];
int mid = (l + r) >> 1;
ll ret = 0;
if (ql <= mid)
ret += query(k << 1, l, mid);
if (qr > mid)
ret += query(k << 1 | 1, mid + 1, r);
return ret;
}
int fa[N], dep[N], top[N], dfn[N], sz[N], son[N], cnt;
void dfs1(int x) {
sz[x] = 1;
int mx = 0;
son[x] = x;
for (auto v : G[x]) {
if (v == fa[x])
continue;
fa[v] = x;
dep[v] = dep[x] + 1;
dfs1(v);
sz[x] += sz[v];
if (sz[v] > mx) {
mx = sz[v];
son[x] = v;
}
}
}
void dfs2(int x, int tp) {
top[x] = tp;
dfn[x] = ++cnt;
id[cnt] = x;
if (son[x] != x)
dfs2(son[x], tp);
for (auto v : G[x]) {
if (v == fa[x] || v == son[x])
continue;
dfs2(v, v);
}
}
void _update(int x, int y) {
while (top[x] != top[y]) {
if (dep[top[x]] < dep[top[y]])
swap(x, y);
ql = dfn[top[x]];
qr = dfn[x];
update(1, 1, n);
x = fa[top[x]];
}
if (dep[x] < dep[y])
swap(x, y);
ql = dfn[y];
qr = dfn[x];
update(1, 1, n);
}
ll _query(int x, int y) {
ll ret = 0;
while (top[x] != top[y]) {
if (dep[top[x]] < dep[top[y]])
swap(x, y);
ql = dfn[top[x]];
qr = dfn[x];
ret += query(1, 1, n);
x = fa[top[x]];
}
if (dep[x] < dep[y])
swap(x, y);
ql = dfn[y];
qr = dfn[x];
ret += query(1, 1, n);
return ret;
}
int main() {
USE_CIN_COUT;
int m;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
cin >> a[i];
for (int i = 1; i < n; ++i) {
int x, y;
cin >> x >> y;
G[x].push_back(y);
G[y].push_back(x);
}
dep[1] = 1;
dfs1(1);
dfs2(1, 1);
build(1, 1, n);
while (m--) {
int op, x, y;
cin >> op >> x >> y;
if (op == 0)
_update(x, y);
else
cout << _query(x, y) << '\n';
}
return 0;
}
其实就是每个点维护一个map,里面是自己子树的颜色,然后每次枚举一个点的所有儿子,和他的兄弟们去算贡献即可,我竟然以为是 O ( n 2 ) O(n^2) O(n2),谈姐姐提醒了才知道,我是傻叉
f i , j , k f_{i,j,k} fi,j,k表示到第i个位置,一共有j段,末尾的颜色为k的时候的最小次数,然后分成两种情况转移即可x
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 14:02:11
File Name :F.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 100010;
char s[maxn];
struct Seg {
int len;
int a;
}ss[maxn];
int dp[maxn][30][15];
void update(int i,int j,int k,int val) {
if(dp[i][j][k] == -1) dp[i][j][k] = val;
else dp[i][j][k] = min(dp[i][j][k],val);
}
int upper(int a,int b) {
if(a%b == 0) return a/b;
return a/b+1;
}
int main() {
int n,l,K;
scanf("%d%d%d",&n,&l,&K);
scanf("%s",s);
int cnt = 0;
ss[cnt].len = 1;
ss[cnt].a = s[0]-'a';
for(int i = 1;i < n;i++) {
cnt++;
ss[cnt].len = 1;
ss[cnt].a = s[i]-'a';
}
memset(dp,-1,sizeof(dp));
for(int i = 0;i < 26;i++) dp[0][i][1] = upper(ss[0].len,l);
dp[0][ss[0].a][1] = 0;
int p = -1,pre = 0,cur = ss[0].len;
for(int i = 1;i <= cnt;i++) {
cur += ss[1].len;
while(cur-pre > l) pre += ss[++p].len;
if(p == -1) {
for(int j = 0;j < 26;j++) dp[i][j][1] = 1;
}
else if(p == i) {
int num = upper(ss[i].len,l);
for(int j = 0;j < 26;j++) {
for(int k = 1;k <= K;k++) {
if(dp[p-1][j][k] == -1) continue;
update(i,j,k,dp[p-1][j][k]+num);
}
}
}
else {
for(int j = 0;j < 26;j++) {
for(int k = 1;k <= K;k++) {
if(dp[p][j][k] == -1) continue;
update(i,j,k,dp[p][j][k]+1);
}
}
}
for(int j = 0;j < 26;j++) {
for(int k = 1;k <= K;k++) {
if(dp[i-1][j][k] == -1) continue;
if(j == ss[i].a) update(i,j,k,dp[i-1][j][k]);
else update(i,ss[i].a,k+1,dp[i-1][j][k]);
}
}
}
int ans = 1e9;
for(int i = 0;i < 26;i++) {
for(int j = 1;j <= K;j++)
if(dp[cnt][i][j] != -1) ans = min(ans,dp[cnt][i][j]);
}
printf("%d\n",ans);
return 0;
}
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 13:36:51
File Name :G.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkdfile() freopen("in.txt","w",stdout);
#define setlargestack(x) int _SIZE=x<<20;char *_PPP=(char*)malloc(_SIZE)+_SIZE;__asm__("movl %0, %%esp\n" :: "r"(_PPP));
#define read2(a,b) read(a),read(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define readg(_x1,_y1,_x2,_y2) read(_x1),read(_y1),read(_x2),read(_y2)
#define USE_CIN_COUT ios::sync_with_stdio(0)
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
namespace fastIO{
#define BUF_SIZE 100000
#define OUT_SIZE 100000
//fread->read
bool IOerror=0;
inline char nc(){
static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
if (pend==p1){IOerror=1;return -1;}
//{printf("IO error!\n");system("pause");for (;;);exit(0);}
}
return *p1++;
}
inline bool blank(char ch){return ch==32||ch==10||ch==13||ch==9;}
inline bool enter(char ch){return ch==10||ch==13;}
inline void read(int &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (sign)x=-x;
}
inline void read(ll &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (sign)x=-x;
}
inline void read(double &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (ch==46){
double tmp=1; ch=nc();
for (;ch>=48&&ch<=57;ch=nc())tmp/=10.0,x+=tmp*(ch-48);
}
if (sign)x=-x;
}
inline void read(char *s){
char ch=nc();
for (;blank(ch);ch=nc());
if (IOerror)return;
for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch;
*s=0;
}
inline void readln(char *s) {
char ch=nc();
for (;blank(ch);ch=nc());
if(IOerror)return;
for(;!enter(ch)&&!IOerror;ch=nc())*s++=ch;
*s=0;
}
inline void read(char &c){
for (c=nc();blank(c);c=nc());
if (IOerror){c=-1;return;}
}
#undef OUT_SIZE
#undef BUF_SIZE
}
using fastIO::read;
int main() {
int n;
while(~scanf("%d",&n)) {
const double PI = acos(-1.0);
double sita = 2*PI/n;
double x = sqrt(2-2*cos(sita));
double area = n*sin(sita)/2;
area += x*(1-cos(sita/2))/2;
printf("%.6f\n",area);
}
return 0;
}
注意去重,以及这题只有12个小时(草
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 14:17:15
File Name :H.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
struct tim {
int h, m, s;
void in() {
cin >> h >> m >> s;
if (h >= 12)
h -= 12;
assert(0 <= h && h < 12);
}
void out() {
cout << h << ' ' << m << ' ' << s << '\n';
}
bool operator != (tim const& oth) const {
return h != oth.h || m != oth.m || s != oth.s;
}
} S;
int dis(tim const& x, tim const& y) {
int s1 = x.h * 60 * 60 + x.m * 60 + x.s;
int s2 = y.h * 60 * 60 + y.m * 60 + y.s;
int ds = s2 - s1;
if (ds < 0)
ds += 60 * 60 * 12;
assert(ds >= 0);
return ds;
}
bool cmp(tim const& x, tim const& y) {
int dx = dis(S, x), dy = dis(S, y);
return dx < dy;
}
int main() {
USE_CIN_COUT;
int n;
cin >> n;
S.in();
auto b = vector<tim>(n);
for (auto& v : b)
v.in();
auto a = vector<tim>();
for (int i = 0; i < n; ++i)
if (S != b[i])
a.push_back(b[i]);
sort(a.begin(), a.end(), cmp);
int ans = min(dis(S, a[SZ(a) - 1]), dis(a[0], S));
for (int i = 0; i < SZ(a); ++i) {
int nxt = i + 1;
if (nxt == SZ(a))
nxt = 0;
if (nxt == i)
continue;
ans = min(ans, dis(S, a[i]) * 2 + dis(a[nxt], S));
ans = min(ans, dis(a[nxt], S) * 2 + dis(S, a[i]));
}
cout << fixed << setprecision(2) << ans * 6.00 << '\n';
return 0;
}
最开始以为 a i a_i ai是不固定的x
如果固定的话只需要7维表示每个的情况即可,然后 O ( k ) O(k) O(k)算贡献
考虑横着某个位置切一刀即可x
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 13:48:17
File Name :J.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
USE_CIN_COUT;
ll n;
while (cin >> n) {
ll ans = 7 + n * (6 + 6 + n - 1) / 2;
cout << ans << '\n';
}
return 0;
}
草为啥数据是多组数据但是题面没有说明啊(#`O′)
显然只有n和m都是4的倍数的时候才可以
然后复制下样例就完事了x
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 14:35:08
File Name :K.cpp
************************************************ */
#include
#include
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
string s[4];
char ans[15][15];
void color_fill(int x, int y) {
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 4; ++j)
ans[x + i][y + j] = s[i][j];
}
int main() {
s[0] = "1113";
s[1] = "2133";
s[2] = "2243";
s[3] = "2444";
int n, m;
while (cin >> n >> m) {
if (n % 4 || m % 4) {
cout << "no response" << '\n';
continue;
}
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= m; ++j)
if (i % 4 == 1 && j % 4 == 1)
color_fill(i, j);
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j)
cout << ans[i][j];
cout << '\n';
}
}
return 0;
}