• SDUT 2022 summer team contest 1st(for 21)


    前言:顺心鲸鱼就是 拉 啦(bushi

    是我太拉跨了,今天久违的组队赛我们打的稀烂

    D - Dice Game

     Kattis - dicegame 

    Gunnar and Emma play a lot of board games at home, so they own many dice that are not normal 66-sided dice. For example they own a die that has 1010 sides with numbers 47, 48, \ldots , 5647,48,…,56 on it.

    There has been a big storm in Stockholm, so Gunnar and Emma have been stuck at home without electricity for a couple of hours. They have finished playing all the games they have, so they came up with a new one. Each player has 2 dice which he or she rolls. The player with a bigger sum wins. If both sums are the same, the game ends in a tie.

    Task

    Given the description of Gunnar’s and Emma’s dice, which player has higher chances of winning?

    All of their dice have the following property: each die contains numbers a, a+1, \dots , ba,a+1,…,b, where aa and bb are the lowest and highest numbers respectively on the die. Each number appears exactly on one side, so the die has b-a+1b−a+1 sides.

    Input

    The first line contains four integers a_1, b_1, a_2, b_2a1​,b1​,a2​,b2​ that describe Gunnar’s dice. Die number ii contains numbers a_ i, a_ i + 1, \dots , b_ iai​,ai​+1,…,bi​ on its sides. You may assume that 1\le a_ i \le b_ i \le 1001≤ai​≤bi​≤100. You can further assume that each die has at least four sides, so a_ i + 3\le b_ iai​+3≤bi​.

    The second line contains the description of Emma’s dice in the same format.

    Output

    Output the name of the player that has higher probability of winning. Output “Tie” if both players have same probability of winning.

    Sample 1

    InputcopyOutputcopy
    1 4 1 4
    1 6 1 6
    
    Emma
    

    Sample 2

    InputcopyOutputcopy
    1 8 1 8
    1 10 2 5
    
    Tie
    

    Sample 3

    InputcopyOutputcopy
    2 5 2 7
    1 5 2 5
    
    Gunnar

     签到

    1. /*Where there is light, in my heart.*/
    2. /*SUMMER_TRAINING DAY 22*/
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. using namespace std;
    9. //
    10. #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    11. //#define INF 0x3f3f3f
    12. #define ll long long
    13. #define INF 0x3f3f3f3f
    14. #define mem(a,b) memset(a,b,sizeof(a))
    15. #define unmap(a,b) unordered_map
    16. #define unset(a) unordered_set

    E - Opening Ceremony

     Kattis - ceremony 

    For the grand opening of the algorithmic games in NlogNsglow, a row of tower blocks is set to be demolished in a grand demonstration of renewal. Originally the plan was to accomplish this with controlled explosions, one for each tower block, but time constraints now require a hastier solution.

    To help you remove the blocks more rapidly you have been given the use of a Universal Kinetic / Incandescent Energy Particle Cannon (UKIEPC). On a single charge, this cutting-edge contraption can remove either all of the floors in a single tower block, or all the xx-th floors in all the blocks simultaneously, for user’s choice of the floor number xx. In the latter case, the blocks that are less than xx floors high are left untouched, while for blocks having more than xx floors, all the floors above the removed xx-th one fall down by one level.

    Task

    Given the number of floors of all towers, output the minimum number of charges needed to eliminate all floors of all blocks.

    Input

    The first line of input contains the number of blocks nn, where 2 \leq n \leq 100\, 0002≤n≤100000. The second line contains nn consecutive block heights h_ ihi​ for i=1,2,\ldots ,ni=1,2,…,n, where 1 \leq h_ i \leq 1\, 000\, 0001≤hi​≤1000000.

    Output

    Output one line containing one integer: the minimum number of charges needed to tear down all the blocks.

    Sample 1

    InputcopyOutputcopy
    6
    2 1 8 8 2 3
    
    5
    

    Sample 2

    InputcopyOutputcopy
    5
    1 1 1 1 10
    
    2
    

     

    1. #include
    2. #include
    3. #include
    4. #include
    5. #include
    6. #include
    7. #define INF 0x3f3f3f3f
    8. #define ll long long
    9. #define ull unsigned long long
    10. #define inf 0x3f3f3f3f3f3f3f3f
    11. #define mem(a, b) memset(a, b, sizeof(a))
    12. #define rep(i, a, b) for (auto i = a; i <= b; ++i)
    13. #define bep(i, a, b) for (auto i = a; i >= b; --i)
    14. #define lowbit(x) x &(-x)
    15. #define PII pair
    16. #define PLL pair
    17. #define PI acos(-1)
    18. #define pb push_back
    19. #define eps 1e-6
    20. #define X1 first
    21. #define Y1 second
    22. #define IOS \
    23. ios::sync_with_stdio(false); \
    24. cin.tie(0); \
    25. cout.tie(0);
    26. const int MO = 1e9 + 10;
    27. const int NN = 1e8 + 10;
    28. const int MM = 1e7 + 10;
    29. const int N = 1e6 + 10;
    30. const int M = 2e5 + 10;
    31. int dx[] = {-1, 0, 1, 0};
    32. int dy[] = {0, 1, 0, -1};
    33. int dxy[][2] = {{0, 1}, {1, 0}, {1, 1}, {-1, 1}};
    34. using namespace std;
    35. int n;
    36. int a[N];
    37. int main()
    38. {
    39. cin>>n;
    40. for(int i=1;i<=n;i++)
    41. {
    42. cin>>a[i];
    43. }
    44. sort(a+1,a+n+1);
    45. int ans=n;
    46. for(int i=1;i<=n;i++)
    47. {
    48. int sum=i+a[n-i];
    49. ans=min(ans,sum);
    50. }
    51. cout<
    52. return 0;
    53. }

    H - Clock Pictures

     Kattis - clockpictures 

    You have two pictures of an unusual kind of clock. The clock has nn hands, each having the same length and no kind of marking whatsoever. Also, the numbers on the clock are so faded that you can’t even tell anymore what direction is up in the picture. So the only thing that you see on the pictures, are nn shades of the nn hands, and nothing else.

    You’d like to know if both images might have been taken at exactly the same time of the day, possibly with the camera rotated at different angles.

    Task

    Given the description of the two images, determine whether it is possible that these two pictures could be showing the same clock displaying the same time.

    Input

    The first line contains a single integer nn (2 \leq n \leq 200\, 0002≤n≤200000), the number of hands on the clock.

    Each of the next two lines contains nn integers a_ iai​ (0 \leq a_ i < 360\, 0000≤ai​<360000), representing the angles of the hands of the clock on one of the images, in thousandths of a degree. The first line represents the position of the hands on the first image, whereas the second line corresponds to the second image. The number a_ iai​ denotes the angle between the recorded position of some hand and the upward direction in the image, measured clockwise. Angles of the same clock are distinct and are not given in any specific order.

    Output

    Output one line containing one word: possible if the clocks could be showing the same time, impossible otherwise.

    Figure 1: Sample input 2

    Sample 1

    InputcopyOutputcopy
    6
    1 2 3 4 5 6
    7 6 5 4 3 1
    
    impossible
    

    Sample 2

    InputcopyOutputcopy
    2
    0 270000
    180000 270000
    
    possible
    

    Sample 3

    InputcopyOutputcopy
    7
    140 130 110 120 125 100 105
    235 205 215 220 225 200 240
    
    impossible
    
    1. #include
    2. #include
    3. #include
    4. #include
    5. #include
    6. #include
    7. #define INF 0x3f3f3f3f
    8. #define ll long long
    9. #define ull unsigned long long
    10. #define inf 0x3f3f3f3f3f3f3f3f
    11. #define mem(a, b) memset(a, b, sizeof(a))
    12. #define rep(i, a, b) for (auto i = a; i <= b; ++i)
    13. #define bep(i, a, b) for (auto i = a; i >= b; --i)
    14. #define lowbit(x) x &(-x)
    15. #define PII pair
    16. #define PLL pair
    17. #define PI acos(-1)
    18. #define pb push_back
    19. #define eps 1e-6
    20. #define X1 first
    21. #define Y1 second
    22. #define IOS \
    23. ios::sync_with_stdio(false); \
    24. cin.tie(0); \
    25. cout.tie(0);
    26. const int MO = 1e9 + 10;
    27. const int NN = 1e8 + 10;
    28. const int MM = 1e7 + 10;
    29. const int N = 1e6 + 10;
    30. const int M = 2e5 + 10;
    31. int dx[] = {-1, 0, 1, 0};
    32. int dy[] = {0, 1, 0, -1};
    33. int dxy[][2] = {{0, 1}, {1, 0}, {1, 1}, {-1, 1}};
    34. using namespace std;
    35. int Next[MM];
    36. int a[MM];
    37. int b[MM];
    38. int cha1[MM];
    39. int cha2[MM];
    40. int n;
    41. /* void getNext()
    42. {
    43. Next[0] = -1;
    44. int k = -1, j = 0;
    45. while (j < 2 * n - 1)
    46. {
    47. if (k == -1 || cha1[j] == cha1[k])
    48. {
    49. Next[++j] = ++k;
    50. }
    51. else
    52. {
    53. k = Next[k];
    54. }
    55. }
    56. } */
    57. void getNext()
    58. {
    59. int i, j;
    60. i = 0;
    61. Next[0] = j = -1;
    62. while (i < n)
    63. {
    64. if (j == -1 || cha1[i] == cha1[j])
    65. {
    66. Next[i + 1] = j + 1;
    67. if (cha1[j + 1] == cha1[i + 1])
    68. Next[i + 1] = Next[j + 1];
    69. i++;
    70. j = j + 1;
    71. }
    72. else
    73. j = Next[j];
    74. }
    75. }
    76. bool kmp(){
    77. int i,j;
    78. i=j=0;
    79. while(i<2*n && j
    80. if(j==-1 || cha1[i]==cha2[j]){
    81. i++;
    82. j++;
    83. }
    84. else j=Next[j];
    85. }
    86. if(j==n) return true;
    87. else return false;
    88. }
    89. int main()
    90. {
    91. cin >> n;
    92. for (int i = 0; i < n; i++)
    93. {
    94. cin >> a[i];
    95. a[i] %= 360;
    96. }
    97. for (int i = 0; i < n; i++)
    98. {
    99. cin >> b[i];
    100. b[i] %= 360;
    101. }
    102. sort(a, a + n);
    103. sort(b, b + n);
    104. for (int i = 0; i < n - 1; i++)
    105. {
    106. cha1[i] = a[i + 1] - a[i];
    107. cha2[i] = b[i + 1] - b[i];
    108. }
    109. cha1[n - 1] = 360 - (a[n - 1] - a[0]);
    110. cha2[n - 1] = 360 - (b[n - 1] - b[0]);
    111. for (int i = n; i <= 2 * n - 1; i++)
    112. {
    113. cha1[i] = cha1[i - n];
    114. }
    115. getNext();
    116. if (kmp())
    117. cout << "possible" << endl;
    118. else
    119. cout << "impossible" << endl;
    120. return 0;
    121. }

     

    K - Train Passengers

     Kattis - trainpassengers 

    The Nordic Company of Passing Carriages is losing money at an alarming rate because most of their trains are empty. However, on some lines the passengers are complaining that they cannot fit in the cars and have to wait for the next train!

    The authorities want to fix this situation. They asked their station masters to write down, for a given train, how many people left the train at their station, how many went in, and how many had to wait. Then they hired your company of highly paid consultants to assign properly sized trains to their routes.

    You just received the measurements for a train, but before feeding them to your optimisation algorithm you remembered that they were collected on a snowy day, so any sensible station master would have preferred to stay inside their cabin and make up the numbers instead of going outside and counting.

    Verify your hunch by checking whether the input is inconsistent, i.e., at every time the number of people in the train did not exceed the capacity nor was below 00 and no passenger waited in vain (i.e., waited on the station when there was room in the train). The train should start and finish the journey empty, in particular passengers should not wait for the train at the last station.

    Input

    The first line contains two integers CC and nn (1 \leq C \leq 10^91≤C≤109, 2 \leq n \leq 1002≤n≤100), the total capacity and the number of stations the train stops in. The next nn lines contain three integers each, the number of people that left the train, entered the train, and had to stay at a station. Lines are given in the same order as the train visits each station. All integers are between 00 and 10^9109 inclusive.

    Output

    One line containing one word: possible if the measurements are consistent, impossible otherwise.

    Sample 1

    InputcopyOutputcopy
    1 2
    0 1 1
    1 0 0
    
    possible
    

    Sample 2

    InputcopyOutputcopy
    1 2
    1 0 0
    0 1 0
    
    impossible
    

    Sample 3

    InputcopyOutputcopy
    1 2
    0 1 0
    1 0 1
    
    impossible
    

    Sample 4

    InputcopyOutputcopy
    1 2
    0 1 1
    0 0 0
    
    impossible
    
    1. #include
    2. #include
    3. #include
    4. #include
    5. #include
    6. using namespace std;
    7. //
    8. #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    9. //#define INF 0x3f3f3f
    10. #define ll long long
    11. #define INF 0x3f3f3f3f
    12. #define mem(a,b) memset(a,b,sizeof(a))
    13. #define unmap(a,b) unordered_map
    14. #define unset(a) unordered_set

     总结:读了个寂寞的题,读了B,I,结果这俩血难,B队友说是dfs但是没写好,结赛以后甚至题解都搜不到,要进一步调整跟帮的思路了,然后就是不会的太多了,C题 那个什么数,我们都不知道,唉

  • 相关阅读:
    Vue---单向数据
    HowHelp免费推广!先到先得
    掌控习惯-学习总结
    Gmail邮箱怎么获取授权码?熟悉一下
    JAVA毕业设计HTML5果蔬经营平台计算机源码+lw文档+系统+调试部署+数据库
    腾然教育MCN覃小龙公子:覃宣量2022年2岁10个月亲子照
    uniapp如何使用api相关提示框
    html、css 教程
    数据结构——二叉树
    Bug是如何产生的?
  • 原文地址:https://blog.csdn.net/LanceLSf/article/details/126001755