前言:顺心鲸鱼就是 拉 啦(bushi
是我太拉跨了,今天久违的组队赛我们打的稀烂
D - Dice Game
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
| Inputcopy | Outputcopy |
|---|---|
1 4 1 4 1 6 1 6 | Emma |
Sample 2
| Inputcopy | Outputcopy |
|---|---|
1 8 1 8 1 10 2 5 | Tie |
Sample 3
| Inputcopy | Outputcopy |
|---|---|
2 5 2 7 1 5 2 5 | Gunnar |
签到
/*Where there is light, in my heart.*/
/*SUMMER_TRAINING DAY 22*/
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
//
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define INF 0x3f3f3f
#define ll long long
#define INF 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
#define unmap(a,b) unordered_map<a,b>
#define unset(a) unordered_set<a>
#define F first
#define S second·
#define pb push_back
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define _rep(i, a, b) for (int i = (a); i >= (b); --i)
#define mode 1e4+7
#define pi acos(-1)
typedef double db;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> vi;
const int N=2e5+5;
//
signed main(){
int sum1=0,sum2=0;
int x,y;
for(int i=0;i<4;i++){
cin>>x;
sum1+=x;
}
for(int i=0;i<4;i++){
cin>>y;
sum2+=y;
}
if(sum1>sum2) cout<<"Gunnar"<<endl;
else if(sum1<sum2) cout<<"Emma"<<endl;
else cout<<"Tie"<<endl;
}
//made by shun 20220725
E - Opening 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
| Inputcopy | Outputcopy |
|---|---|
6 2 1 8 8 2 3 | 5 |
Sample 2
| Inputcopy | Outputcopy |
|---|---|
5 1 1 1 1 10 | 2 |
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cstdio>
#define INF 0x3f3f3f3f
#define ll long long
#define ull unsigned long long
#define inf 0x3f3f3f3f3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for (auto i = a; i <= b; ++i)
#define bep(i, a, b) for (auto i = a; i >= b; --i)
#define lowbit(x) x &(-x)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PI acos(-1)
#define pb push_back
#define eps 1e-6
#define X1 first
#define Y1 second
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
const int MO = 1e9 + 10;
const int NN = 1e8 + 10;
const int MM = 1e7 + 10;
const int N = 1e6 + 10;
const int M = 2e5 + 10;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int dxy[][2] = {{0, 1}, {1, 0}, {1, 1}, {-1, 1}};
using namespace std;
int n;
int a[N];
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
sort(a+1,a+n+1);
int ans=n;
for(int i=1;i<=n;i++)
{
int sum=i+a[n-i];
ans=min(ans,sum);
}
cout<<ans<<endl;
return 0;
}
H - Clock Pictures
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
| Inputcopy | Outputcopy |
|---|---|
6 1 2 3 4 5 6 7 6 5 4 3 1 | impossible |
Sample 2
| Inputcopy | Outputcopy |
|---|---|
2 0 270000 180000 270000 | possible |
Sample 3
| Inputcopy | Outputcopy |
|---|---|
7 140 130 110 120 125 100 105 235 205 215 220 225 200 240 | impossible |
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cstdio>
#define INF 0x3f3f3f3f
#define ll long long
#define ull unsigned long long
#define inf 0x3f3f3f3f3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for (auto i = a; i <= b; ++i)
#define bep(i, a, b) for (auto i = a; i >= b; --i)
#define lowbit(x) x &(-x)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PI acos(-1)
#define pb push_back
#define eps 1e-6
#define X1 first
#define Y1 second
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
const int MO = 1e9 + 10;
const int NN = 1e8 + 10;
const int MM = 1e7 + 10;
const int N = 1e6 + 10;
const int M = 2e5 + 10;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int dxy[][2] = {{0, 1}, {1, 0}, {1, 1}, {-1, 1}};
using namespace std;
int Next[MM];
int a[MM];
int b[MM];
int cha1[MM];
int cha2[MM];
int n;
/* void getNext()
{
Next[0] = -1;
int k = -1, j = 0;
while (j < 2 * n - 1)
{
if (k == -1 || cha1[j] == cha1[k])
{
Next[++j] = ++k;
}
else
{
k = Next[k];
}
}
} */
void getNext()
{
int i, j;
i = 0;
Next[0] = j = -1;
while (i < n)
{
if (j == -1 || cha1[i] == cha1[j])
{
Next[i + 1] = j + 1;
if (cha1[j + 1] == cha1[i + 1])
Next[i + 1] = Next[j + 1];
i++;
j = j + 1;
}
else
j = Next[j];
}
}
bool kmp(){
int i,j;
i=j=0;
while(i<2*n && j<n){
if(j==-1 || cha1[i]==cha2[j]){
i++;
j++;
}
else j=Next[j];
}
if(j==n) return true;
else return false;
}
int main()
{
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i];
a[i] %= 360;
}
for (int i = 0; i < n; i++)
{
cin >> b[i];
b[i] %= 360;
}
sort(a, a + n);
sort(b, b + n);
for (int i = 0; i < n - 1; i++)
{
cha1[i] = a[i + 1] - a[i];
cha2[i] = b[i + 1] - b[i];
}
cha1[n - 1] = 360 - (a[n - 1] - a[0]);
cha2[n - 1] = 360 - (b[n - 1] - b[0]);
for (int i = n; i <= 2 * n - 1; i++)
{
cha1[i] = cha1[i - n];
}
getNext();
if (kmp())
cout << "possible" << endl;
else
cout << "impossible" << endl;
return 0;
}
K - Train Passengers
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
| Inputcopy | Outputcopy |
|---|---|
1 2 0 1 1 1 0 0 | possible |
Sample 2
| Inputcopy | Outputcopy |
|---|---|
1 2 1 0 0 0 1 0 | impossible |
Sample 3
| Inputcopy | Outputcopy |
|---|---|
1 2 0 1 0 1 0 1 | impossible |
Sample 4
| Inputcopy | Outputcopy |
|---|---|
1 2 0 1 1 0 0 0 | impossible |
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
//
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define INF 0x3f3f3f
#define ll long long
#define INF 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
#define unmap(a,b) unordered_map<a,b>
#define unset(a) unordered_set<a>
#define F first
#define S second·
#define pb push_back
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define _rep(i, a, b) for (int i = (a); i >= (b); --i)
#define mode 1e4+7
#define pi acos(-1)
typedef double db;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> vi;
const int N=2e5+5;
//
signed main(){
int num,t;
cin>>num>>t;
int dd,tt,ww;
int sum=0;
int flag=1;
while(t--){
cin>>dd>>tt>>ww;
if(flag){
sum-=dd;
if(sum<0){
flag=0;
continue;
}
sum+=tt;
if(num-sum<0){
flag=0;
continue;
}
else if(num-sum>0&&ww>0){
flag=0;
continue;
}
}
}
if(flag&&sum==0) cout<<"possible"<<endl;
else cout<<"impossible"<<endl;
}
//made by happywhale 20220726
总结:读了个寂寞的题,读了B,I,结果这俩血难,B队友说是dfs但是没写好,结赛以后甚至题解都搜不到,要进一步调整跟帮的思路了,然后就是不会的太多了,C题 那个什么数,我们都不知道,唉
博主分享了一次组队比赛的经历,团队在名为D-DiceGame的难题中遭遇挑战,需要计算两位玩家Gunnar和Emma使用特殊骰子赢得比赛的概率。通过分析骰子特性,探讨谁更可能获胜,同时介绍了Kattis平台上相关题目如DiceGame和ClockPictures的解题思路。
3622

被折叠的 条评论
为什么被折叠?



