竟然有半IOI赛制(雾)
R a n k Rank Rank | P e r s o n Person Person | S c o r e Score Score | A A A | B B B | C C C |
---|---|---|---|---|---|
1 1 1 | 2017 m y s e l f 2017myself 2017myself | 150 150 150 | 60 60 60 | 90 90 90 | 0 0 0 |
2 2 2 | 2015 h j w 2015hjw 2015hjw | 140 140 140 | 100 100 100 | 40 40 40 | 0 0 0 |
3 3 3 | 2015 z y f 2015zyf 2015zyf | 100 100 100 | 80 80 80 | 20 20 20 | 0 0 0 |
4 4 4 | 2017 l r z 2017lrz 2017lrz | 100 100 100 | 100 100 100 | 0 0 0 | 0 0 0 |
5 5 5 | 2017 z y c 2017zyc 2017zyc | 90 90 90 | 0 0 0 | 90 90 90 | 0 0 0 |
6 6 6 | 2017 x j q 2017xjq 2017xjq | 90 90 90 | 0 0 0 | 90 90 90 | 0 0 0 |
7 7 7 | 2017 x x y 2017xxy 2017xxy | 90 90 90 | 0 0 0 | 90 90 90 | 0 0 0 |
8 8 8 | 2017 h j q 2017hjq 2017hjq | 60 60 60 | 0 0 0 | 60 60 60 | 0 0 0 |
9 9 9 | 2015 z z y 2015zzy 2015zzy | 50 50 50 | 0 0 0 | 50 50 50 | 0 0 0 |
10 10 10 | 2017 l w 2017lw 2017lw | 40 40 40 | 10 10 10 | 20 20 20 | 10 10 10 |
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/82943456
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/82943475
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/82855481
#include
#define N 100010
using namespace std;
int n,a,p[N],m,ans;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a);
for(int j=2;j*j<=a;j++)
while(!(a%j))
p[j]++,a/=j,ans++;
if(a>1) p[a]++,ans++;
}
m=1;
while(true)
{
if(!ans) break;
m++;a=m;
for(int j=2;j*j<=a;j++)
while(!(a%j))
{
if(p[j])
p[j]--,ans--;
a/=j;
}
if(a<=100000&&p[a]) p[a]--,ans--;
}
printf("%d",m);
}
#include
#include
#include
#include
#include
#define N 510
using namespace std;
const int dx[5]={0,-1,0,0,1},dy[5]={0,0,-1,1,0};
struct node{
int x,y,f;
};
queue<node> q;
int a[N][N],v[N][N][5],n,m,iq[N][N][5];
char c;
int bfs()
{
memset(v,127/3,sizeof(v));
if(a[1][1]==0) return 2147483647;
if(a[1][1]!=1)
{
q.push((node){1,1,1});
iq[1][1][1]=1;
v[1][1][1]=0;
}
if(a[1][1]!=2)
{
q.push((node){1,1,2});
iq[1][1][2]=1;
v[1][1][2]=0;
}
if(a[1][1]!=3)
{
q.push((node){1,1,3});
iq[1][1][3]=1;
v[1][1][3]=0;
}
if(a[1][1]!=4)
{
q.push((node){1,1,4});
iq[1][1][4]=1;
v[1][1][4]=0;
}
while(!q.empty())
{
int x=q.front().x,y=q.front().y,f=q.front().f;
for(int k=1;k<=4;k++)
{
if(a[x][y]!=k&&v[x][y][k]>v[x][y][f]+1)
{
//printf("Trun %d,%d %d->%d\n",x,y,f,k);
v[x][y][k]=v[x][y][f]+1;
if(!iq[x][y][k])
{
iq[x][y][k]=true;
q.push((node){x,y,k});
}
}
}
if(x+dx[f]>0&&x+dx[f]<=n&&y+dy[f]>0&&y+dy[f]<=m
&&a[x+dx[f]][y+dy[f]]&&a[x+dx[f]][y+dy[f]]!=f
&&v[x+dx[f]][y+dy[f]][f]>v[x][y][f])
{
//printf("Go %d,%d->%d,%d\n",x,y,x+dx[f],y+dy[f]);
v[x+dx[f]][y+dy[f]][f]=v[x][y][f];
if(!iq[x+dx[f]][y+dy[f]][f])
{
iq[x+dx[f]][y+dy[f]][f]=true;
q.push((node){x+dx[f],y+dy[f],f});
}
}
iq[x][y][f]=false;
q.pop();
}
return min(min(v[n][m][1],v[n][m][2]),min(v[n][m][3],v[n][m][4]));
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{
cin>>c;
if(c=='U') a[i][j]=1;
else if (c=='D') a[i][j]=4;
else if (c=='L') a[i][j]=2;
else if (c=='R') a[i][j]=3;
else a[i][j]=0;
}
a[n][m]=1;
int ans=bfs();
if(ans>=707406000) printf("No Solution");
else printf("%d",ans);
}
#include
#include
#include
#include
#define N 510
using namespace std;
const int dx[5]={0,-1,0,0,1},dy[5]={0,0,-1,1,0};
struct node{
int x,y,w;
};
queue<node> q;
int a[N][N],path[N][N],n,m;
char c;
int bfs()
{
q.push((node){1,1,-1});
while(!q.empty())
{
int x=q.front().x,y=q.front().y,w=q.front().w;
q.pop();
for(int k=1;k<=4;k++)
{
int dis=1;
while(x+dx[k]*dis<=n&&x+dx[k]*dis>0&&y+dy[k]*dis<=m&&y+dy[k]*dis>0
&&a[x+dx[k]*(dis-1)][y+dy[k]*(dis-1)]!=k&&a[x+dx[k]*dis][y+dy[k]*dis])
{
if(!path[x+dx[k]*dis][y+dy[k]*dis])
{
q.push((node){x+dx[k]*dis,y+dy[k]*dis,w+1});
path[x+dx[k]*dis][y+dy[k]*dis]=1;
if(x+dx[k]*dis==n&&y+dy[k]*dis==m)
return w+1;
}
dis++;
}
}
}
return -1;
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{
cin>>c;
if(c=='U') a[i][j]=1;
else if (c=='D') a[i][j]=4;
else if (c=='L') a[i][j]=2;
else if (c=='R') a[i][j]=3;
else a[i][j]=0;
}
int ans=bfs();
if(ans==-1) printf("No Solution");
else printf("%d",ans);
}
没了