sgu你敢不敢把内存搞大点!!!!!
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<cstring>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#define i64 __int64
#define out64 "%I64d\n"
#define in64 "%I64d"
#else
#define i64 long long
#define out64 "%lld\n"
#define in64 "%lld"
#endif
#define FOR(i,a,b) for( int i = (a) ; i <= (b) ; i ++)
#define FF(i,a) for( int i = 0 ; i < (a) ; i ++)
#define FFD(i,a) for( int i = (a)-1 ; i >= 0 ; i --)
#define S64(a) scanf(in64,&a)
#define SS(a) scanf("%d",&a)
#define LL(a) ((a)<<1)
#define RR(a) (((a)<<1)+1)
#define SZ(a) ((int)a.size())
#define PP(n,m,a) puts("---");FF(i,n){FF(j,m)cout << a[i][j] << ' ';puts("");}
#define pb push_back
#define CL(Q) while(!Q.empty())Q.pop()
#define MM(name,what) memset(name,what,sizeof(name))
#define read freopen("in.txt","r",stdin)
#define write freopen("osr.txt","w",stdout)
const int inf = 0x3f3f3f3f;
const i64 inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double oo = 10e9;
const double eps = 10e-10;
const double pi = acos(-1.0);
struct zz
{
int id;
int s;
bool operator < (const zz & cmp ) const
{
return s < cmp.s;
}
}zx;
int n,k;
int temp;
int id;
int s[5555];
int a[5555];
vector<zz>v;
bool c1(int x)
{
return !(x&1);
}
bool c2(int x)
{
temp = x;
if(x>=11)
{
x%=11;
if(temp<110 && c1(x)) return true;
x+=11;
if(x<=18)
{
return c1(x);
}
return false;
}
else
{
return c1(x);
}
}
bool c3(int x)
{
temp = x;
if(x>=101)
{
x%=101;
if(temp < 1010 && c2(x)) return true;
x+=101;
if(x<=117)
{
return c2(x);
}
return false;
}
else
{
return c2(x);
}
}
bool c4(int x)
{
temp = x;
if(x>=1001)
{
x%=1001;
if(temp < 10010 && c3(x)) return true;
x+=1001;
if(x<=1026)
{
return c3(x);
}
return false;
}
else
{
return c3(x);
}
}
bool c5(int x)
{
temp = x;
if(x>=10001)
{
x%=10001;
if( temp<100010 && c4(x)) return true;
x+=10001;
if(x<=10035)
{
return c4(x);
}
return false;
}
else
{
return c4(x);
}
}
bool c6(int x)
{
temp = x;
if( x>= 100001)
{
x%=100001;
if(temp < 1000010 && c5(x)) return true;
x += 100001;
if(x<=100044)
{
return c5(x);
}
return false;
}
else
{
return c5(x);
}
}
bool c7(int x)
{
temp = x;
if(x>=1000001)
{
x%=1000001;
if(temp<10000010 && c6(x)) return true;
x += 1000001;
if(x<=1000053)
{
return c6(x);
}
return false;
}
else
{
return c6(x);
}
}
int main()
{
cin>>n;
{
int iv=0;
v.clear();
cin>>k;
for(int i=1;i<=k;i++)
{
SS(s[i]);
zx.s = s[i];
zx.id = i;
v.pb(zx);
}
sort(v.begin(),v.end());
zx.s=-1;
zx.id=0;
v.push_back(zx);
id = 0;
for(int i=1;i<=n;i++)
{
if(!c7(i))
{
id++;
if(id == v[iv].s)
{
a[v[iv].id] = i;
iv++;
while(id == v[iv].s)
{
a[v[iv].id] = i;
iv++;
}
if(iv == k+1)
{
break;
}
}
}
}
cout<<id<<endl;
FOR(i,1,k-1)
{
printf("%d ",a[i]);
}
printf("%d\n",a[k]);
}
// system("pause");
return 0;
}
分享到:
相关推荐
ID 标题 交流电 A + B 18881 互质 7697 第3分部 6906 ... 108 自我数字II 2149 144 会议 2121 175 编码方式 2032年 231 本金 2003年 134 质心 1931年 180 反演 1906年 106 等式 1884
sgu oj上的 101-121 的AC代码
SGU-801综合通讯接入装置使用说明书
SGU离线题库(2015-6-8整理),图片可以显示。。
SGU题库 Volume (100-199) pdf整合版
SGU-乌苏里奥斯日报 | | | | bre Sobre o projeto 最终开发基于Web的软件开发学科(2021年),以及由USUDo和UD CRUD com联合开发的Express,MongoDB数据库。 :rocket: 技术 :laptop: 安装,执行和分解 先决条件 ...
SGU题库整合 Volume (200 - 299) pdf版
下载调度程序,用于低带宽环境。 全天扩展下载量
SGU推荐题目分类,适合初次使用sgu的编程爱好者使用!
SGU 390 AC源码,数位统计的难题
SGU 385,我写的程序,一道DP题,跟概率有关
辛苦整理所得,分略多,绝对值得,sgu完整题库(530个网页,还有试题难度排序)。lnddszp[at]gmail[dot]com
SGU 103AC 代码 质量有保证!
SGU 333 集训队AC程序,秒过,CPP
sgu ##这是一个将我的 sol 问题存储到 acm.sgu.ru 的存储库
“#babylonjs-sgu”
sgu-开发这是当前正在开发的星际之门宇宙游戏的最新版本。 凉爽的
poj2723 2-sat验证,二分答案 poj2455 dinic (ek会超时) hdu1689 求最小奇数环 poj2391 isap最快,dinic不减枝会超时 poj2455 isap 最快(ek会超时) poj2832 并查集边的计算 sgu218 hcraft 二分图匹配验证 二分答案
pku sgu 经典图论题解答, 多种方法解答经典图论题, 附源代码
我的解决方案代码适用于流行的在线裁判系统,例如 POJ、HDOJ、SGU 和 ACM-ICPC Live Archive。 但是,我忘记了我用来解决这些问题的算法! 我将通过竞赛来组织代码和解决方案。 一些索引页面将可用,以便您可以更快...