第四阶段组队训练赛第六场( 题源:UKIEPC2017)

A: Alien Sunset

题目描述

Following tremendous advances in space flight control software and equally impressive innova- tions in reality TV crowdfunding, humans have successfully settled a number of planets, moons, asteroids, and various other kinds of funny-shaped rocks across our solar system.
To celebrate, the Galactic President has elected to create a new holiday called "Solar Night". At the crux of the event, she decrees, every settlement will simultaneously launch colourful fireworks into the darkness of night.
Night, like most things, is a difficult problem in space. Every spacebound object has its own day length and period of rotation. Thankfully all of the settlements did, at least, start their clocks at the same moment. Settlements may have started in daylight or darkness and so it is possible that the first recorded sunrise can be either before or after the first hour of sunset.
By convention, the President’s term lasts for exactly 1825 days as measured by the planet with the longest period of rotation. The celebration needs to happen within that time or it will not serve its intended purpose.
Determine how many hours must pass for us to find a suitable time to celebrate Solar Night.

输入

?One line containing the integer N (1 ≤ N ≤ 20), the number of settlements.
?N lines, each containing three integers:

–H (2 ≤ H ≤ 100), the number of hours in this settlement’s solar day.
–R and T (0 ≤ R, T ≤ H ? 1, R≠T ), the hours of sunrise and sunset respectively.

At sunrise and sunset, a settlement is in darkness. At times strictly in between sunrise and sunset, a settlment is in daylight.

输出

Output the number of hours that must pass from when the settlement clocks began until each settlement is in darkness. If no suitable time occurs in the first 1825 days, output impossible.

样例输入

2
24 7 19
24 18 6

样例输出

6
#include<bits/stdc++.h>
using namespace std;
bool ap[200050];
int main()
{
    int n,hh;
    scanf("%d",&n);
    hh=0;
    int h,r,t;
    while(n--)
    {
        scanf("%d %d %d",&h,&r,&t);
        hh=max(h,hh);
        r+=1;
        t+=1;
        if(t<r)
        {
            for(int i=1;i<t;i++)
            {
                ap[i]=1;
            }
            t=t+h;
        }
        int cnt;
        for(int i=r+1;i<=t-1;i++)
        {
            cnt=0;
            while(i+h*cnt<=183000)
            {
                ap[i+h*cnt]=1;
                cnt++;
            }
        }
    }
    for(int i=1;i<=hh*1825;i++)
    {
        if(ap[i]==0)
        {
            printf("%d\n",i-1);
            return 0;
        }
    }
    printf("impossible\n");
    return 0;
}

————————————————分割线————————————————

B: Breaking Biscuits

题目描述

This year, Walter’s workplace resolved to try something radically different: they’re going to change the weekly order of biscuits for the break room to a whole other brand.
Biscuits come in many shapes and sizes, but the particular brand they settled on has two special qualities:
? It is completely planar (two-dimensional);
? It is perfectly polygon-shaped.
However, disaster struck immediately: the available mugs in the break room are too narrow for Walter to be able to dunk these new biscuits into, no matter what combination of rotations along the three axes he tries.
There is only one thing for it: Walter will need to order another mug.
Before taking this drastic step, it is vital to know how wide the diameter of this mug will need to be in order to succesfully accommodate a (possibly rotated) biscuit of the new brand.

输入

? One line containing an integer N (3 ≤ N ≤ 100), the number of vertices in the biscuit.
? Each of the following N lines contains two space-separated integers Xi and Yi (?105 ≤Xi, Yi ≤ 105), the coordinates of the i-th vertex.
Vertices are always given in anti-clockwise order. Also, as anyone can tell you, biscuits never self-intersect and always have positive area.

输出

Output the minimum possible diameter of the new mug, in order that it can fit the new kind of biscuit fully inside in at least one orientation. The output must be accurate to an absolute or relative error of at most 10?6.

样例输入

4
0 0
5 0
5 2
0 2

样例输出

2.0

分析:

计算凸包  旋转卡壳法计算最短距离

#include <bits/stdc++.h>

using namespace std;
struct Point
{
    double x,y;
    Point(double x=0,double y=0):x(x),y(y){}
};
typedef Point Vector;
//bool operator <(const Point& a,const Point& b)
//{
//    return a.x<b.x||(a.x==b.x&&a.y<b.y);
//}
bool cmp(Point a,Point b)
{
    return a.x<b.x||(a.x==b.x&&a.y<b.y);
}
Vector operator - (Point A,Point B){return Vector(A.x-B.x,A.y-B.y);}
//Vector operator + ()
double Cross(Vector A,Vector B)
{
    return A.x*B.y-A.y*B.x;
}
double Dot(Vector A,Vector B)
{
    return A.x*B.x+A.y*B.y;
}
double Length(Vector A)
{
    return sqrt(Dot(A,A));
}
int n;
Point ch[200],p[200];
int ConvexHull()
{
    sort(p,p+n,cmp);
    int m=0;
    for(int i=0;i<n;i++)
    {
        while(m>1&&Cross(ch[m-1]-ch[m-2],p[i]-ch[m-2])<=0)  m--;
        ch[m++]=p[i];
    }
    int k=m;
    for(int i=n-2;i>=0;i--)
    {
        while(m>k&&Cross(ch[m-1]-ch[m-2],p[i]-ch[m-2])<=0)  m--;
        ch[m++]=p[i];
    }
    if(n>1) m--;
    return m;
}
double Distance(Point P,Point A,Point B)
{
    Vector v1=B-A,v2=P-A;
    return fabs(Cross(v1,v2))/Length(v1);
}
int main()
{
//    freopen("in.txt","r",stdin);

    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%lf%lf",&p[i].x,&p[i].y);
    }
    int nn=ConvexHull();
    double maxn,minn=(double)1000000007;
//    printf("%lf\n",minn);
//    for(int i=0;i<nn;i++)
//        cout<<ch[i].x<<" "<<ch[i].y<<endl;
    for(int i=1;i<nn;i++)
    {
        maxn=-1;
        if(i>1)
        {
            for(int j=0;j<i-1;j++)
            {
                if(Distance(ch[j],ch[i],ch[i-1])>maxn)
                    maxn=Distance(ch[j],ch[i],ch[i-1]);
            }
        }
        for(int j=i+1;j<nn;j++)
        {
           if(Distance(ch[j],ch[i],ch[i-1])>maxn)
                maxn=Distance(ch[j],ch[i],ch[i-1]);
        }
        if(maxn<minn)
            minn=maxn;
//        minn=min(minn,maxn);
    }
    maxn=-1;
    for(int i=1;i<nn-1;i++)
    {

//        printf("%lf\n",Distance(ch[i],ch[0],ch[nn-1]));
        if(Distance(ch[i],ch[0],ch[nn-1])>maxn)
            maxn=Distance(ch[i],ch[0],ch[nn-1]);
    }
    if(maxn<minn)
        minn=maxn;
    printf("%.6lf\n",minn);
    return 0;
}
 

————————————————分割线————————————————

问题 C: Cued In

题目描述

Snooker is a cue sport played by two players on a rectangular table. The players take turns to pot a series of balls of varying colours, where each colour represents a distinct point value for potting the ball.
A player may pot any ball on the table initially, however any subsequent shots must follow a pattern: if the previous ball was red, the next ball must be another colour; otherwise, if there are still red balls left, the next ball must be red.
Balls of any colour other than red are initially replaced on the table every time they are potted, and may be used again to score more points. The balls stop being replaced once all of the red balls have been potted.
The values of each coloured ball are:

Snooker players are respected universally for their prowess in mental arithmetic. One sweeping glance across the table is enough to tell an experienced contestant how much they could score.
For newer players, however, this is a challenge. Write a program to help calculate a score for a given list of balls remaining on the table.

输入

?one line containing the integers N (1 ≤ N ≤ 21), the number of balls remaining on the table.
?N further lines, each containing the colour of one of the balls on the table.
The list of balls will not be ordered in any way and will contain at most one of each of yellow, green, brown, blue, pink and black.

输出

Output the largest possible score the player can make.

样例输入

5
red
black
pink
red
red

样例输出

37
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int a[10]={0};
    int n;
    cin>>n;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        if(s=="yellow")
        {
            a[2]++;
        }
        else if(s=="green")
        {
            a[3]++;
        }
        else if(s=="brown")
        {
            a[4]++;
        }
        else if(s=="blue")
        {
            a[5]++;
        }
        else if(s=="pink")
        {
            a[6]++;
        }
        else if(s=="black")
        {
         a[7]++;
        }
        else
        {
            a[1]++;
        }
    }
    int pos;
//
//    for(int i=1;i<=7;i++)
//    {
//        cout<<a[i]<<endl;
//    }

    for(int i=7;i>=1;i--)
    {
        if(a[i])
        {
            pos = i;
            break;
        }
    }
    int ans = 0;
    if(pos==1)
    {
        cout<<1<<endl;
        return 0;
    }
    else
    {
        ans += (1+pos)*a[1];
    }

    for(int i=pos;i>=2;i--)
    {
        ans+=a[i]*i;
    }
    cout<<ans<<endl;
    return 0;
}

————————————————分割线————————————————

D: Deranging Hat

题目描述

In the wizarding world of security, there are two kinds of researcher: the idealist arranging hat and the mercenary deranging hat.
As we learned last year, an arranging hat carefully sorts out any list of letters given to it into ascending order.  However, a deranging hat performs the exact opposite function: putting a sorted string of letters back into its original order.
The tool of choice for today’s discerning headwear is a sorting network: a sequence of instruc- tions represented by a list of pairs of numbers Ai and Bi, meaning that if at step i the A-th item in the string is not already smaller than the B-th item, they should be swapped immediately.
Given a specific word W , output a sorting network that the deranging hat can use to form the word from its original sorted letters.

输入

One line containing one string of lowercase Latin letters (‘a’-‘z’), S, containing at most 1000 characters.

输出

Output at most 10000 lines, each containing two integers Ai and Bi (1 ≤ Ai, Bi ≤ |S|) giving the i-th operation to perform.

样例输入

dude

样例输出

4 3
3 2//排序问题
#include<bits/stdc++.h>
using namespace std;
char s[1005];
int main()
{
    scanf("%s",s);
    int len=strlen(s);
    int a[100005],b[100005],cnt1=0;
    for(int i=0;i<len;i++)
    {
        for(int j=i+1;j<len;j++)
        {
            if(s[i]>s[j])
            {
                a[cnt1]=i+1;
                b[cnt1]=j+1;
                cnt1++;
                swap(s[i],s[j]);
            }
        }
    }
    for(int i=cnt1-1;i>=0&&i>=cnt1-10000;i--)
    {
        printf("%d %d\n",b[i],a[i]);
    }
    return 0;
}

————————————————分割线————————————————

E: Education

题目描述

Seeking to cash in on the lucrative private education business, EduCorp recently established the prestigious ”Bootcamp Academy of Economics” and, counter to their early projections, is growing rapidly.
So rapidly, in fact, that the student body is already overflowing the small (but prestigious) campus building and now needs to be contained somewhere else while more new (and prestigious) buildings are built.
Each department will sell off its original space and then move into its own new rented building. As departments are deeply territorial, buildings must not be shared. Because this is an economics academy, the capacities and rents of each of all the local available buildings were easy to find by disguising the task as homework.
However, it still remains to choose which buildings to rent so as to minimise total budget. This is where you can help.

输入

?one line containing the integers n and m (1 ≤ n ≤ m ≤ 5000), the number of departments and buildings respectively.
?one line containing n integers s1 ... sn (1 ≤ si ≤ 1000 for each i), where si is the number of students in department i.
?one line containing m integers p1 ... pm (1 ≤ pi  ≤ 1000 for each i), where pi is the capacity of building i.
?one line containing m integers r1 ... rm (1 ≤ ri ≤ 1000 for each i), where ri is the yearly rental cost of building i.

输出

If it is not possible to rent enough buildings for all the departments, output impossible.
Otherwise, output possible.

样例输入

2 5
40 200
1000 199 201 10 50
600 300 400 200 800

样例输出

possible

题目被简化了 被老师改成不是spj的题 最后一行的数据没用 就成了又一道水题 不过这题看了好久 才知道最后一行没用

#include <bits/stdc++.h>

using namespace std;

const int maxn = 5005;

int main()
{
    int n,m;
    cin>>n>>m;
    int a[maxn];
    int b[maxn];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<m;i++)
        cin>>b[i];
    int x;
    for(int i=0;i<m;i++)
        cin>>x;
    sort(a,a+n);
    sort(b,b+m);
    int now = 0;
    for(int i=0;i<m;i++)
    {
        if(a[now]<=b[i])
            now++;
        if(now==n)
            break;
    }
    if(now==n)
    {
        cout<<"possible"<<endl;
        return 0;
    }
    else
    {
        cout<<"impossible"<<endl;
        return 0;
    }
    return 0;
}

————————————————分割线————————————————

F: Flipping Coins

题目描述

Here’s a jolly and simple game: line up a row of N identical coins, all with the heads facing down onto the table and the tails upwards, and for exactly K times take one of the coins, toss it into the air, and replace it as it lands either heads-up or heads-down. You may keep all of the coins that are face-up by the end.
Being, as we established last year, a ruthless capitalist, you have resolved to play optimally to win as many coins as you can. Across all possible combinations of strategies and results, what is the maximum expected (mean average) amount you can win by playing optimally?

输入

?One line containing two space-separated integers:
–N (1 ≤ N ≤ 400), the number of coins at your mercy;
–K (1 ≤ K ≤ 400), the number of flips you must perform.

输出

Output the expected number of heads you could have at the end, as a real number. The output must be accurate to an absolute or relative error of at most 10?6.

样例输入

2 1

样例输出

0.5
分析:数学期望 dp//我第一题看的这道题 和之前一次训练赛的题类似 更简化了

这个是那道题的题面和解析:https://www.cnblogs.com/hao-tian/p/9552423.html
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

double dp[405][405];
//double p[405];

int main()
{
//    p[0] = 1;
//    for(int i=1; i<=100; i++)
//    {
//        p[i] = p[i-1]/2.0;
//    }
    int n,k;
    scanf("%d%d",&n,&k);
    dp[0][0] = 1;
    for(int i=0; i<k; i++)
    {
        for(int j=0; j<=n; j++)
        {
            if(dp[i][j]==0)
                continue;
            if(n-j>=1)
            {
                dp[i+1][j+1] += dp[i][j]*0.5;
                dp[i+1][j] += dp[i][j]*0.5;
            }
            else
            {
                dp[i+1][j] += dp[i][j]*0.5;
                dp[i+1][j-1] += dp[i][j]*0.5;
            }
        }
    }
    double ans = 0;
    for(int i=1;i<=n;i++)
    {
        ans+=dp[k][i]*i;
    }
    printf("%.6f",ans);
    return 0;
}

————————————————分割线————————————————

I: I Work All Day

题目描述

Michael is a lumberjack, and a pretty OK one at that. However, automation is making fast (if polite) inroads to his business, and he needs to stay ahead to remain competitive.
To this end, he has invented a machine called the Flannelmaster GTX. This is a fearsome tree- cutting contraption, powered by logarithms, which swings an axe horizontally from a specified height above the ground. Each impact of its electronic axe cuts the tree cleanly into two parts, the stump rolling away and the remainder of the tree falling down into the same place.
This continues until the remaining height is too small to cut any more, at which point any irregular-sized stump is discarded as waste and the remaining lumber of the same length as the setting is neatly packaged and sold on automatically.
What setting should Michael use for the height in order to minimise loss?

输入

? One line containing the integer N (2 ≤ N ≤ 10), the number of settings;
? One line containing N distinct integers Hi (1 ≤ H ≤ 500), the possible settings;
? One line containing the integer T (1 ≤ T ≤ 3000), the height of the tree.

输出

Output the best setting to use so that tree waste will be minimal. If there are multiple settings that yield equally small waste, you may print any one of them.

样例输入

3
5 6 8
103

样例输出

6
#include <bits/stdc++.h>

using namespace std;
int n,h[100],t;
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&h[i]);
    scanf("%d",&t);
    int tmp,pos,ans=3005;
    for(int i=0;i<n;i++)
    {
        tmp=t%h[i];
        if(tmp<ans)
        {
            ans=tmp;
            pos=i;
        }
    }
    printf("%d\n",h[pos]);
//    cout << "Hello world!" << endl;
    return 0;
}

————————————————分割线————————————————

J: Just A Minim

题目描述

Listening to music is a good way to take one’s mind off the monotony of typing out solution after correct solution.
However, it can be very annoying to start listening to a tune and then for time to run out early, cutting the listening short. How much more satisfying it would be if you could choose tunes to fit the time available!
With this in mind, you have found a way to code musical scores into simple lists of numbers representing the length of the notes in each tune as follows:

Given such a list of numbers, calculate the length of the tune in notes.

输入

? One line containing the integer N (1 ≤ N ≤ 2000), the number of values in the tune.
? one line containing N integers each representing the length of a value using the codes above.

输出

Output the length of the tune, as a real number of notes. The output must be accurate to an absolute or relative error of at most 10?6.

样例输入

4
1 1 1 0

样例输出

5
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int op,n;
    double ans=0;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&op);
        if(op==0)
        {
            ans+=2;
        }
        else
        {
            ans+=(double)1.0/(op*1.0);
        }
    }
    printf("%.6lf\n",ans);
    return 0;
}
 

————————————————分割线————————————————

L: Lounge Lizards

题目描述

Monitor lizards are a kind of reptile known mainly for their cold-bloodedness and addiction to computer screens. Due to their love for digital displays, these scaly creatures spend most of their time at home glued to a small television in the lounge.
Conflict has arisen at one particular reptile house. The audience here has grown so large that not everyone will be able to see the screen at once any more; specifically, a lizard will only be able to see enough if it is strictly taller than all of the lizards sitting exactly along the straight line from itself to the television.
Monitor lizards aren’t particularly picky about the actual contents of the screen or being able to see it obliquely (or even from the front)—they just want to be able to keep an eye on it.
The lizards don’t want to move, however. It’s possible to chase a monitor lizard away in order for the ones behind it to see, or leave it alone, but re-homing somewhere else in the room is unthinkable.
Assuming lizards are removed optimally, how many at most can remain and still see the screen?

输入

? one line containing the space-separated integers TX and TY (?106 ≤ TX, TY ≤ 106), the co-ordinates of the television.
? one line containing the integer N (1 ≤ N ≤ 106), the number of lizards.
? N further lines, each containing three space-separated integers XiYiHi (?106 ≤ X, Y ≤106; 1 ≤ H ≤ 106), the co-ordinates and height respectively of one lizard.
The co-ordinates of all televisions and lizards will be distinct.

输出

Output the maximum number of lizards that can stay and watch television at once.

样例输入

50 50
2
60 50 1
65 50 2

样例输出

2

计算每个点的方向向量 ,然后按照方向向量排序 ,如果相同,按照距离排序,计算这些相同的点的LIS ans加一下就是答案

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int n;
const int inf=0x3f3f3f3f;
const int maxn = 1e6+5;
struct P
{
    int x,y,h;
    ll dis;
}a[maxn],o;
int dp[maxn];
int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}
bool cmp(P a,P b)
{
    if(a.x!=b.x) return a.x<b.x;
    else if(a.y!=b.y) return a.y<b.y;
    else return a.dis<b.dis;
}
int f(int l,int r)
{
    int idx=1,where;
    for(int i=l;i<r;i++)
        dp[i]=inf;
    dp[idx]=a[l].h;
    for(int i=l+1;i<r;i++)
    {
        if(a[i].h>dp[idx])
        {
            idx++;
            dp[idx]=a[i].h;
        }
        else
        {
            where=lower_bound(dp+1,dp+idx+1,a[i].h)-dp;
            dp[where]=a[i].h;
        }
    }
//    for(int i=1;i<=idx;i++)
//    cout<<dp[i]<<endl;
    return idx;
}
int main()
{
    scanf("%d%d",&o.x,&o.y);
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].h);
        a[i].x -= o.x;
        a[i].y -= o.y;
        a[i].dis = (ll)a[i].x*a[i].x + (ll)a[i].y*a[i].y;

        int t = gcd(abs(a[i].x),abs(a[i].y));
        a[i].x/=t;
        a[i].y/=t;
    }
    sort(a,a+n,cmp);
    int j;
    int ans = 0;
    for(int i=0; i<n; i=j)
    {
        j = i+1;
        while(j<n&&a[i].x==a[j].x&&a[i].y==a[j].y)
        {
            j++;
        }
        ans += f(i,j);
    }
    printf("%d\n",ans);
    return 0;
}

原文地址:https://www.cnblogs.com/hao-tian/p/9552363.html

时间: 2024-10-07 14:55:56

第四阶段组队训练赛第六场( 题源:UKIEPC2017)的相关文章

2018年第四阶段组队训练赛第三场(BAPC2017 Preliminaries)

D.Disastrous Doubling 题目描述 A scientist, E. Collie, is going to do some experiments with bacteria.Right now, she has one bacterium. She already knows that this species of bacteria doubles itself every hour. Hence, after one hour there will be 2 bacter

2018年第四阶段组队训练赛第七场

A: Secret of Chocolate Poles 题目描述 Wendy, the master of a chocolate shop, is thinking of displaying poles of chocolate disks in the showcase. She can use three kinds of chocolate disks: white thin disks, dark thin disks, and dark thick disks. The thin

UPC2018组队训练赛第七场

题目来自ICPC 2017 Japan Tsukuba A题:Secret of Chocolate Poles 有三种巧克力,分别是厚度为1的白色巧克力,厚度为1或者k的黑色巧克力.要求把巧克力放到高度为 l 的盒子里,并且要黑白相间,底部和顶部必须都是黑色的 当l=1,ans=1:当l<k,ans=(l-1)/2+1:当l=k,ans=(l-1)/2+2;当l>k时,就可以转化成排列组合问题了,枚举厚度为k的黑色巧克力数目i,然后对于每一种情况,再枚举厚度为1的黑色巧克力的数目j,那么此时

2018-2019赛季多校联合新生训练赛第六场(2018/12/15)补题题解

A 价钱统计(基础编程能力) 这个考点还是比较个性的,怎么四舍五入 解法 常规的讲如果四舍五入整数位的话,那么只需要在后面加个0.5然后强制转换一下就可以了 这个却要我们保留一位小数的四舍五入,那该怎么做呢 实际上我们只需要把这个数乘以10然后加0.5,强制转换后再除以10就可以了 代码 #include <bits/stdc++.h> using namespace std; double trans(double a) { a*=10; a+=0.5; a=int(a); a/=10; r

Contest1814 - 2019年我能变强组队训练赛第七场

Scores of Final Examination On-Screen Keyboard Tally Counters Balance Scale #pragma GCC optimize(3,"Ofast","inline") #include <bits/stdc++.h> using namespace std; typedef long long ll; unordered_map<ll,bool> m1; int n,m,cnt

Contest1539 - 2019年我能变强组队训练赛第十一场

Greater New York 2012 Hailstone HOTPO #pragma GCC optimize(3,"Ofast","inline") #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; int T; cin>>T; while(T--) { ll k; scanf("%lld %lld&q

Contest1657 - 2019年我能变强组队训练赛第十四场

Contest1657 - 2019年我能变强组队训练赛第十四场 Similarity of Subtrees #include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; const int maxn=100100; ull ha[maxn]; vector<int>E[maxn]; unordered_map<ull,int>m;

1780 - 2019年我能变强组队训练赛第十八场

题目描述 wls有一个钟表,当前钟表指向了某一个时间. 又有一些很重要的时刻,wls想要在钟表上复现这些时间(并不需要依次复现).我们可以顺时针转动秒针,也可以逆时针转动秒针,分针和时针都会随着秒针按规则转动,wls想知道秒针至少转动多少角度可以使每个时刻至少都会被访问一次. 注意,时钟上的一种时针分针秒针的组合,可以代表两个不同的时间. 输入 第一行一个整数n代表有多少个时刻要访问. 第二行三个整数h,m,s分别代表当前时刻的时分秒. 最后n行每一行三个整数hi,mi,si代表每个要访问的时刻

HDU 5371 (2015多校联合训练赛第七场1003)Hotaru&#39;s problem(manacher+二分/枚举)

HDU 5371 题意: 定义一个序列为N序列:这个序列按分作三部分,第一部分与第三部分相同,第一部分与第二部分对称. 现在给你一个长为n(n<10^5)的序列,求出该序列中N序列的最大长度. 思路: 来自官方题解:修正了一些题解错别字(误 先用求回文串的Manacher算法,求出以第i个点为中心的回文串长度,记录到数组p中 要满足题目所要求的内容,需要使得两个相邻的回文串,共享中间的一部分,也就是说,左边的回文串长度的一半,要大于等于共享部分的长度,右边回文串也是一样. 因为我们已经记录下来以