2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest

A . Xu Xiake in Henan Province

 

Shaolin Monastery, also known as the Shaolin Temple, is a Chan ("Zen") Buddhist temple in Dengfeng County, Henan Province. Believed to have been founded in the 55-th century CE, the Shaolin Temple is the main temple of the Shaolin school of Buddhism to this day.

 

Longmen Grottoes, are some of the finest examples of Chinese Buddhist art. Housing tens of thousands of statues of Buddha and his disciples, they are located 1212kilometres (7.57.5 mi) south of present-day Luoyang in Henan province.

 

White Horse Temple is, according to tradition, the first Buddhist temple in China, established in 6868 AD under the patronage of Emperor Ming in the Eastern Han dynasty capital Luoyang.

 

The Yuntai Mountain is situated in Xiuwu County, Jiaozuo, Henan Province. The Yuntai Geo Park scenic area is classified as an AAAAA scenic area by the China National Tourism Administration. Situated within Yuntai Geo Park, with a fall of 314 metres, Yuntai Waterfall is claimed as the tallest waterfall in China.

 

They are the most famous local attractions in Henan Province.

 

 

Now it's time to estimate the level of some travellers. All travellers can be classified based on the number of scenic spots that have been visited by each of them.

 

  • A traveller that visited exactly 00 above-mentioned spot is a "Typically Otaku".
  • A traveller that visited exactly 11 above-mentioned spot is a "Eye-opener".
  • A traveller that visited exactly 22 above-mentioned spots is a "Young Traveller".
  • A traveller that visited exactly 33 above-mentioned spots is a "Excellent Traveller".
  • A traveller that visited all 44 above-mentioned spots is a "Contemporary Xu Xiake".

 

Please identify the level of a traveller.

 

Input

 

The input contains several test cases, and the first line contains a positive integer TT indicating the number of test cases which is up to 104104.

 

For each test case, the only one line contains four integers A1A1, A2A2, A3A3 and A4A4, where AiAi is the number of times that the traveller has visited the ii-th scenic spot, and 0A1,A2,A3,A41000≤A1,A2,A3,A4≤100. If AiAi is zero, it means that the traveller has never been visiting the ii-th spot.

 

Output

 

For each test case, output a line containing one string denoting the classification of the traveller which should be one of the strings "Typically Otaku", "Eye-opener", "Young Traveller", "Excellent Traveller" and "Contemporary Xu Xiake" (without quotes).

 

Example

 

Input
5
0 0 0 0
0 0 0 1
1 1 0 0
2 1 1 0
1 2 3 4
Output
Typically Otaku
Eye-opener
Young Traveller
Excellent Traveller
Contemporary Xu Xiake

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
typedef long long lli;
using namespace std;
const int  mxn = 1e9;
multiset<int> mu;
    #define fi      first
    #define se      second
    #define pb      push_back
    #define pql     priority_queue<lli>
    #define pq      priority_queue<int>
    #define ok      return 0;
    #define oi(x)   cout<<x<<endl;
    #define os(str) cout<<string(str)<<endl;
using namespace std;
//multiset<int> :: iterator it ;
//int dir[6][3] = {0,0,1,0,0,-1,1,0,0,-1,0,0,0,1,0,0,-1,0};           //三维六向
//int dir[8][2] = {2,1,2,-1,-2,1,-2,-1,1,2,1,-2,-1,2,-1,-2};          //马走日
//int dir[4][2] = {1,0,-1,0,0,1,0,-1};                                //二维四向
//int dir[8][2]={1,0,1,1,1,-1,-1,0,-1,1,-1,-1,0,1,0,-1};              //全方位
#define en(xx) xx.begin(),xx.end()
#define rep(j,k) for (int i = j;   i < k;  i++)
#define per(j,k) for (int i = j-1; i >= k; i--)
  typedef pair < int, int > pii;
  typedef pair < lli, lli > pll;
  typedef vector < lli > vl;
  typedef vector < int > vi;

int main()
{
    int t,a,b,c,d;
    cin>>t;
    while(t--)
    {
        b=0;
        for(int i=0;i<4;i++)
        {
            cin>>a;
            if(a>0)
                b++;
        }
        if(!b)
            cout<<"Typically Otaku"<<endl;
        else if(b==1)
            cout<<"Eye-opener"<<endl;
        else if(b==2)
            cout<<"Young Traveller"<<endl;
        else if(b==3)
            cout<<"Excellent Traveller"<<endl;
        else if(b==4)
            cout<<"Contemporary Xu Xiake"<<endl;
    }
}
View Code

 

 

I. Distance  (模拟)

There are nn points on a horizontal line, labelled with 11 through nn from left to right.

The distance between the ii-th point and the (i+1)(i+1)-th point is aiai.

For each integer kk ranged from 11 to nn, you are asked to select exactly kk different given points on the line to maximize the sum of distances between all pairs of selected points.

Input

The input contains several test cases, and the first line contains a positive integer TT indicating the number of test cases which is up to 10001000.

For each test case, the first line contains an integer nn indicating the number of points, where 2n1052≤n≤105.

The second line contains (n1)(n−1) positive integers a1,a2,,an1a1,a2,⋯,an−1, where 1ai1041≤ai≤104.

We guarantee that the sum of nn in all test cases is up to 106106.

Output

For each test case, output a line containing nn integers, the ii-th of which is the maximum sum of distances in case k=ik=i. You should output exactly one whitespace between every two adjacent numbers and avoid any trailing whitespace in this line.

Example

Input
1
5
2 3 1 4
Output
0 10 20 34 48

Note

The figure below describes the sample test case.

The only best selection for k=2k=2 should choose the leftmost and the rightmost points, while a possible best selection for k=3k=3 could contain any extra point in the middle.

 

 

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
typedef long long lli;
using namespace std;
multiset<int> mu;
    #define fi      first
    #define se      second
    #define pb      push_back
    #define pql     priority_queue<lli>
    #define pq      priority_queue<int>
    #define ok      return 0;
    #define oi(x)   cout<<x<<endl;
    #define os(str) cout<<string(str)<<endl;
using namespace std;
//multiset<int> :: iterator it ;
//int dir[6][3] = {0,0,1,0,0,-1,1,0,0,-1,0,0,0,1,0,0,-1,0};           //三维六向
//int dir[8][2] = {2,1,2,-1,-2,1,-2,-1,1,2,1,-2,-1,2,-1,-2};          //马走日
//int dir[4][2] = {1,0,-1,0,0,1,0,-1};                                //二维四向
//int dir[8][2]={1,0,1,1,1,-1,-1,0,-1,1,-1,-1,0,1,0,-1};              //全方位
#define en(xx) xx.begin(),xx.end()
#define rep(j,k) for (int i = j;   i < k;  i++)
#define per(j,k) for (int i = j-1; i >= k; i--)
  typedef pair < int, int > pii;
  typedef pair < lli, lli > pll;
  typedef vector < lli > vl;
  typedef vector < int > vi;
#define TLE std::ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);   cout.precision(10);
const int mxn = 2e5 + 10;
lli t,n,l,r,cnt,a[mxn],c[mxn];
int main()
{
    TLE;
    cin>>t;
    while(t--)
    {
        cin >> n;
        a[1] = 0;
        for(int i = 2; i <= n; i++)
        {
            cin>>a[i];
            a[i]+=a[i-1];
        }
        l = 2,r = n - 1;
        c[1] = 0,c[2] = a[n];
        cnt = a[n];
        for(int i = 3; i <= n; i++)
        {
            if(i & 1)
            {
                c[i] = c[i-1] + cnt;
            }
            else
            {
                cnt += a[r] - a[l];
                c[i] = c[i-1] + cnt;
                l++;r--;
            }
        }
        cout<<c[1];
        for(int i = 2; i <=n; i++)
        {
            cout<<" "<< c[i];
        }
        cout << endl;
    }
    
    return 0;
}

 

posted @ 2019-10-05 22:35  __MEET  阅读(265)  评论(0编辑  收藏  举报