比赛 |
20120705 |
评测结果 |
AAAEEEEEEE |
题目名称 |
绘画 |
最终得分 |
30 |
用户昵称 |
Citron酱 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2012-07-05 11:52:50 |
显示代码纯文本
#include <fstream>
#include <string>
#define I_F "drawing.in"
#define O_F "drawing.out"
const short MAXn=100;
const short MAXs=100;
std::ifstream fin(I_F);
std::ofstream fout(O_F);
int d[MAXs][MAXn][MAXn];
int now[MAXn][MAXn];
short n, l=0;
void Save();
void Load();
void Paint();
inline short Abs(const short&);
int main()
{
int m;
std::string t;
for (short i=0; i<MAXn; ++i)
for (short j=0; j<MAXn; ++j)
now[i][j]=1;
for (fin>>n>>m>>m; m>0; --m)
{
fin>>t;
if (t=="SAVE")
Save();
else if (t=="LOAD")
Load();
else
Paint();
}
for (short i=0; i<n; ++i)
{
for (short j=0; j<n-1; ++j)
fout<<now[i][j]<<' ';
fout<<now[i][n-1]<<std::endl;
}
fin.close();
fout.close();
}
void Save()
{
for (short i=0; i<n; ++i)
for (short j=0; j<n; ++j)
d[l][i][j]=now[i][j];
++l;
}
void Load()
{
short x;
fin>>x;
--x;
for (short i=0; i<n; ++i)
for (short j=0; j<n; ++j)
now[i][j]=d[x][i][j];
}
void Paint()
{
short a,b,c,d;
int e;
fin>>e>>a>>b>>c>>d;
for (int i=a; i<=c; ++i)
for (int j=b+Abs((i%2)-(a%2)); j<=d; j+=2)
now[i][j]=e;
}
inline short Abs(const short &x)
{
return (x<0)?-x:x;
}