Third Site of acm_icpc Network Competition: Xi'an division, acm_icpc Xi'an Division

Source: Internet
Author: User
Tags printable characters

Third Site of acm_icpc Network Competition: Xi'an division, acm_icpc Xi'an Division

Chp didn't come .. Then I spent an afternoon with zmc .. One of the three questions appears to be a DP water question .. Then we both won't dp .. Question A is not mentioned. Question E is A game theory template .. Then neither of us can play the game theory .. Template found on site .. Question F: brainless BFS .. In the first place, we thought we had no courage to do sad ..

Question:

Post Robot Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission (s): 57 Accepted Submission (s): 51


Problem DescriptionDT is a big fan of digital products. He writes posts about original ical products almost everyday in his blog.

But there is such few comments of his posts that he feels depressed all the day. as his best friend and an excellent programmer, DT asked you to help make his blog look more popular. he is so warm that you have no idea how to refuse. but you are unwilling to read all of his boring posts word by word. so you decided to write a script to comment below his posts automatically.

After observation, you found words "Apple" appear everywhere in his posts. after your counting, you concluded that "Apple", "iPhone", "iPod", "iPad" are the most high-frequency words in his blog. once one of these words were read by your smart script, it will make a comment "MAI! ", And go on reading the post.

In order to make it more funny, you, as a fan of Sony, also want to make some comments about Sony. so you want to add a new rule to the script: make a comment "sony dafa is good!" When "Sony" appears.
 
InputA blog article described above, which contains only printable characters (whose ASCII code is between 32 and 127), CR (ASCII code 13, '\ R' in C/C ++ ), LF (ASCII code 10, '\ n' in C/C ++), please process input until EOF. note all characters are Case sensitive.

The size of the article does not exceed 8KB.
OutputOutput shocould contains comments generated by your script, one per line.
Sample Input
Apple bananaiPad lemon ApplepiSony233Tim cook is doubi from AppleiPhoneipadiPhone30 is so biiiiiiig Microsoftmakes good App.
 
Sample Output
MAI MAI MAI!MAI MAI MAI!MAI MAI MAI!SONY DAFA IS GOOD!MAI MAI MAI!MAI MAI MAI!MAI MAI MAI!
Water 1Y;

#include <cstdio>#include <cstring>#include <cmath>#include <cstdlib>#include <iostream>#include <algorithm>#include <vector>#include <stack>using namespace std;#define LL long longchar s[1000010];int main(){while(gets(s)){int len=strlen(s);for(int i=0;i<len;i++)if(!strncmp(s+i,"Apple",5))puts("MAI MAI MAI!");    else if(!strncmp(s+i,"iPhone",6))puts("MAI MAI MAI!");else if(!strncmp(s+i,"iPod",4))puts("MAI MAI MAI!");else if(!strncmp(s+i,"iPad",4))puts("MAI MAI MAI!");else if(!strncmp(s+i,"Sony",4))puts("SONY DAFA IS GOOD!");}return 0;}

E:

Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission (s): 55 Accepted Submission (s): 41


Problem DescriptionHere is a game for two players. The rule of the game is described below:

● In the beginning of the game, there are a lot of piles of beads.

● Players take turns to play. each turn, player choose a pile I and remove some (at least one) beads from it. then he coshould do nothing or split pile I into two piles with a beads and B beads. (a, B> 0 and a + B equals to the number of beads of pile I after removing)

● If after a player's turn, there is no beads left, the player is the winner.

Suppose that the two players are all very clever and they will use optimal game strategies. Your job is to tell whether the player who plays first can win the game.
InputThere are multiple test cases. Please process till EOF.

For each test case, the first line contains a postive integer n (n <105) means there are n piles of beads. the next line contains n postive integer, the I-th postive integer ai (ai <231) means there are ai beads in the I-th pile.
OutputFor each test case, if the first player can win the game, ouput "Win" and if he can't, ouput "Lose"
Sample Input
1121 131 2 3
 
Sample Output
WinLoseLose

Game theory Nimm Game)

This is a game in which any heap of stones and the number of stones in each heap are arbitrary. The rules are as follows:
1) Each step should take at least one stone; each step can only take part or all stones from a pile;
2) whoever gets the last stone wins.
That is, Nimm Game ).

Conclusion: assume there are n items and each item has a [I, if a [0] ^ a [1] ^ a [2] ^ ........ a [n-1]! = 0 the first hand wins, otherwise the second hand wins.

#include <cstdio>using namespace std;int main(){int n,t,x;while(~scanf("%d",&n)){scanf("%d",&t);--n;while(n--){scanf("%d",&x);t^=x;}if(t)puts("Win");else puts("Lose");}return 0;}

Question F:

Dice Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission (s): 93 Accepted Submission (s): 54


Problem DescriptionThere are 2 special dices on the table. on each face of the dice, a distinct number was written. consider a1.a2, a3, a4, a5, a6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice. similarly, consider b1.b2, b3, b4, b5, b6 to be numbers on specific faces of dice B. it's guaranteed that all numbers written on dices are integers no smaller than 1 and no more than 6 while ai =aj and bi =bj for all I =j. specially, sum of numbers on opposite faces may not be 7.

At the beginning, the two dices may face different (which means there exist some I, ai = bi ). ddy wants to make the two dices look the same from all directions ctions (which means for all I, ai = bi) only by the following four rotation operations. (Please read the picture for more information)


Now Ddy wants to calculate the minimal steps that he has to take to achieve his goal.
 
InputThere are multiple test cases. Please process till EOF.

For each case, the first line consists of six integers a1, a2, a3, a4, a5, a6, representing the numbers on dice.

The second line consists of six integers b1, b2, b3, b4, b5, b6, representing the numbers on dice B.
OutputFor each test case, print a line with a number representing the answer. If there's no way to make two dices exactly the same, output-1.
Sample Input
1 2 3 4 5 61 2 3 4 5 61 2 3 4 5 61 2 5 6 4 31 2 3 4 5 61 4 2 5 3 6
 
Sample Output
03-1

Six-dimensional BFS.

#include <cstdio>#include <cstring>#include <cstdlib>#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <stack>using namespace std;struct node{int a[7],step;};bool vis[7][7][7][7][7][7];int s[7],e[7];void bfs(){queue <node> Q;node t,f;for(int i=1;i<7;i++)t.a[i]=s[i];t.step=0;vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);while(!Q.empty()){f=Q.front();Q.pop();if(f.a[1]==e[1]&&f.a[2]==e[2]&&f.a[3]==e[3]&&f.a[4]==e[4]&&f.a[5]==e[5]&&f.a[6]==e[6]){printf("%d\n",f.step);return ;}t.step=f.step+1;//leftt.a[1]=f.a[4];t.a[2]=f.a[3];t.a[3]=f.a[1];t.a[4]=f.a[2];t.a[5]=f.a[5];t.a[6]=f.a[6];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}//rightt.a[1]=f.a[3];t.a[2]=f.a[4];t.a[3]=f.a[2];t.a[4]=f.a[1];t.a[5]=f.a[5];t.a[6]=f.a[6];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}//frontt.a[1]=f.a[6];t.a[2]=f.a[5];t.a[3]=f.a[3];t.a[4]=f.a[4];t.a[5]=f.a[1];t.a[6]=f.a[2];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}//backt.a[1]=f.a[5];t.a[2]=f.a[6];t.a[3]=f.a[3];t.a[4]=f.a[4];t.a[5]=f.a[2];t.a[6]=f.a[1];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}}    puts("-1");}int main(){while(~scanf("%d",&s[1])){memset(vis,0,sizeof(vis));for(int i=2;i<7;i++)scanf("%d",&s[i]);for(int i=1;i<7;i++)scanf("%d",&e[i]);bfs();}return 0;}



ACM-ICPC Asian Competition Network Competition general difficulty how? Question proportion?

Let me explain to you, LZ. No, no, no, but the meeting is not difficult. If you ask questions here, it means that you have not entered the competition, it is very difficult for you to perform the online competition. I have suffered several abuse attacks, then, I tried to refresh the question, and it would take a while. I am the gold medal of the ACM benchmark. Is there a lot of weight to answer this question?

ACM/ICPC semi-finals original question + Data/online evaluation

Enter the URL acm.bit.edu.cn.
Open the acm interface of Beijing Institute of Technology, which contains some questions about the competition.
URL: acm.hit.edu.cn open the acm interface of Harbin Institute of Technology, which also contains competition questions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.