2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 - A C F H

jasperreport开发手册--ireport教程 iReport   http://www.jasperreport.net 一、介绍 iReport是一个能够创建复杂报表的开源项目,它100%使用Java语言编写,是目前全球最为流行的开源报表设计器之一。 由于它丰富的图形界面,你能够很快的创建出任何一种你想要的报表。 以下是iReport一些比较突出的功能: • 拖拽式,所见即所得的报表编辑器; • 多样的向导来简化复杂的报表设计任 阅读详情

A: Banana

time limit

200ms

memory limit

131072KB

Bananas are the favoured food of monkeys.

In the forest, there is a Banana Company that provides bananas from different places.

The company has two lists.

The first list records the types of bananas preferred by different monkeys, and thesecond one records the types of bananas from different places.

Now, the supplier wants to know, whether a monkey can accept at least one type ofbananas from a place.

Remenber that, there could be more than one types of bananas from a place, and therealso could be more than one types of bananas of a monkey's preference.

Input Format

The first line contains an integer T , indicating that there are T test cases.
For each test case, the first line contains two integers
N and M, representing the

length of the first and the second lists respectively.
In the each line of following
N lines, two positive integers i, j indicate that the i-th

monkey favours the j-th type of banana.
In the each line of following
M lines, two positive integers j, k indicate that the j-th

type of banana could be find in the k-th place.All integers of the input are less than 50.

Output Format

page1image13536

For each test case, output all the pairs x, y that the x-the monkey can accept at leastone type of bananas from the y-th place.

These pairs should be outputted as ascending order. That is say that a pair of x, ywhich owns a smaller x should be output first.

If two pairs own the same x, output the one who has a smaller y first.And there should be an empty line after each test case. 


题意:

已知每个猴子对应香蕉种类,每个香蕉种类对应供应商。

求猴子对应的供应商。

#include <vector>
#include <stdio.h>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <string.h>
using namespace std;
#define LL long long
const int inf = 0x3f3f3f3f;
const int maxn =55;
int mp[maxn][maxn];
int hou[maxn][maxn];
int h[maxn],ban[maxn];
void init()
{
    memset(mp,0,sizeof mp);
    memset(hou,0,sizeof hou);
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        init();
        int n,m;
        scanf("%d %d",&n,&m);
        for(int i=1;i<=n;i++) scanf("%d %d",&h[i],&ban[i]);
        for(int i=1;i<=m;i++)
        {
            int a,b;scanf("%d %d",&a,&b);//香蕉 店
            mp[a][b]=1;
        }
        for(int i=1;i<=n;i++)
        {
            int ho=h[i];
            int b=ban[i];
            for(int j=1;j<=50;j++)
            {
                if(mp[b][j])
                {
                    hou[ho][j]=1;
                }
            }
        }
        for(int i=1;i<=50;i++)
        {
            for(int j=1;j<=50;j++)
            {
                if(hou[i][j]==1)
                {
                    printf("%d %d\n",i,j);
                }
            }
        }
        printf("\n");
    }
    return 0;
}



C: Coconut

time limit

200ms

memory limit

131072KB
Coconut is Captain Gangplank's favourite fruit. That is why he needs to drink coconut

juice from b coconuts each day.

On his next trip, he would pass through N citis.

His trip would begin in the 1-st city and end in the N-th city.

The journey from the i-th city to the (i + 1)-th city costs Di days.

Initially, there is no coconut on his ship. Fortunately, he could get supply of Ci coconutsfrom the i-th city.

Could you tell him, whether he could drink coconut juice every day during the trip no not?

page4image12192

Input Format

The first line contains an integer T , indicating that there are T test cases.
For each test case the first line contains two integers
N and b as described above.The second line contains N integers C1 , C2 , ⋯ , CN .
The third line contains
N − 1 integers D1 , D2 , ⋯ , DN −1 .
All integers in the input are less than
1000.

Output Format

For each case, output Yes if Captain Gangplank could drink coconut juice every day,and otherwise output No. 


题意:

从1按顺序走到n,给你每条路用的时间,和每天要喝的数量,每座城市有的饮料数。

判断中途会不会喝光,喝光no。


#include <vector>
#include <stdio.h>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <string.h>
using namespace std;
#define LL long long
const int inf = 0x3f3f3f3f;
const int maxn =1100;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int n,b;
        scanf("%d %d",&n,&b);
        int c[maxn];
        int d[maxn];
        for(int i=1;i<=n;i++) scanf("%d",&c[i]);
        for(int i=1;i<n;i++) scanf("%d",&d[i]);
        int now=c[1];
        int flag=1;
        for(int i=1;i<n;i++)
        {
            if(now<d[i]*b)
            {
                flag=0;
                break;
            }
            else
                now=now-d[i]*b+c[i+1];
        }
        if(flag) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

F: Islands

time limit

1000ms

memory limit

131072KBpage8image9400

On the mysterious continent of Tamriel, there is a great empire founded by human.

To develope the trade, the East Empire Company is set up to transport goods fromplace to place.

Recently, the company wants to start their business in Solstheim, which is consists of Nislands.

Luckily, there are already M sea routes.
All routes are one-way, and the
i-th route can transport person and goods from island ui

to vi.
Now, the company nominates you a particular job to plan some new routes to make

sure that person and goods can be transported between any two islands.

Furthermore, because the neighboring regions are under attack by an increasingnumber of dragons, limited resources can be used to set up new routes.

So you should plan to build new routes as few as possible.

Input Format

The first line contains an integer T , indicating that there are T test cases.For each test case, the first line includes two integers N (N ≤ 10000) and

M (M ≤ 100000), as described above.
After that there are
M lines. Each line contains two integers ui and vi.

Output Format

For each test case output one integer, represent the least number of routes required tonew. 


题意:

给你n个点和m条边,求出在添加几条边变成强连通。

point:

tarjan算法。


#include <vector>
#include <stdio.h>
#include <iostream>
#include <stdio.h>
#include <stack>
#include <string.h>
using namespace std;
#define LL long long
const int inf = 0x3f3f3f3f;
const int maxn = 10000 + 10;
const int maxm = 100000 + 10;
vector<int> G[maxn];
int T;
int n,m;
int cor[maxn],numcor,low[maxn],dfn[maxn],tm;
int inq[maxn];
stack<int> q;
void init()
{
    for(int i=0;i<=n;i++) G[i].clear();
    numcor=0;
    memset(cor,0,sizeof cor);
    memset(low,0,sizeof low);
    memset(dfn,0,sizeof dfn);
    memset(inq,0,sizeof inq);
    tm=0;
    while(!q.empty()) q.pop();
}
void tanjar(int u)
{
    dfn[u]=low[u]=++tm;
    q.push(u);
    inq[u]=1;
    for(int i=0;i<G[u].size();i++)
    {
        int v=G[u][i];
        if(dfn[v]==0)
        {
            tanjar(v);
            if(low[u]>low[v])
            {
                low[u]=low[v];
            }
        }
        else if(inq[v]==1&&low[u]>dfn[v])
        {
            low[u]=dfn[v];
        }
    }
    if(dfn[u]==low[u])
    {
        numcor++;
        int v;
        do
        {
            v=q.top();
            cor[v]=numcor;
            inq[v]=0;
            q.pop();
        }
        while(v!=u);
        
    }
}
int main()
{
    scanf("%d",&T);
    while(T--)//特判
    {
        scanf("%d %d",&n,&m);
        init();
        int uu[maxm],vv[maxm];
        for(int i=1;i<=m;i++)
        {
            int u,v;scanf("%d %d",&u,&v);
            G[u].push_back(v);
            uu[i]=u;
            vv[i]=v;
        }
        for(int i=1;i<=n;i++)
        {
            if(dfn[i]==0)
            {
                tanjar(i);
            }
        }
        int ru[maxn],chu[maxn];
        memset(ru,0,sizeof ru);
        memset(chu,0,sizeof chu);
        for(int i=1;i<=m;i++)
        {
            if(cor[vv[i]]==cor[uu[i]]) continue;
            ru[cor[vv[i]]]++;
            chu[cor[uu[i]]]++;
        }
        int ru0=0,chu0=0;
        int k=0;
        for(int i=1;i<=numcor;i++)
        {
            if(ru[i]==0&&chu[i]==0)
            {
               k++;
            }
            if(ru[i]==0) ru0++;
            if(chu[i]==0) chu0++;
        }
        if(k==1&&numcor==1) printf("0\n");
        else
        {
            printf("%d\n",max(ru0,chu0));
        }
    }
    
    return 0;
}


H: Skiing

time limit

1000ms

memory limit

131072KB

page11image9944

In this winter holiday, Bob has a plan for skiing at the mountain resort.

This ski resort has M different ski paths and N different flags situated at those turningpoints.

The i-th path from the Si-th flag to the Ti-th flag has length Li.
Each path must follow the principal of reduction of heights and the start point must be

higher than the end point strictly.

An available ski trail would start from a flag, passing through several flags along thepaths, and end at another flag.

Now, you should help Bob find the longest available ski trail in the ski resort.

Input Format

The first line contains an integer T , indicating that there are T cases.
In each test case, the first line contains two integers
N and M where 0 < N ≤ 10000

and 0 < M ≤ 100000 as described above.
Each of the following
M lines contains three integers Si, Ti, and Li (0 < Li < 1000)

describing a path in the ski resort.

Output Format

For each test case, ouput one integer representing the length of the longest ski trail. 



题意:

n个点,m条边,求出能走的最长路。


point:

记忆化搜索。队友的代码。


#include <vector>
#include <stdio.h>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <string.h>
using namespace std;
#define LL long long
const int inf = 0x3f3f3f3f;
const int maxn = 10000 + 10;
int n,m,t,vis[maxn];
struct node
{
    int next,dist;
    node(int a,int b){next = a,dist = b;}
};
vector<node>e[maxn];
int dfs(int x)
{
    if(vis[x]) return vis[x];
    for(int i=0;i<e[x].size();i++)
    {
        int nx = e[x][i].next,dis = e[x][i].dist;
        vis[x] = max(vis[x],dfs(nx)+dis);
    }
    return vis[x];
}
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        int ans = 0;
        memset(vis,0,sizeof vis);
        scanf("%d%d",&n,&m);
        for(int i=0;i<=n;i++) e[i].clear();
        for(int i=0;i<m;i++)
        {
            int u,v,dist;
            scanf("%d%d%d",&u,&v,&dist);
            e[u].push_back(node(v,dist));
        }
        for(int i=1;i<=n;i++) ans = max(ans,dfs(i));
        printf("%d\n",ans);
    }
    return 0;
}


第43届ACM亚洲区域总决赛赛(EC-Final)总结 现在才来填坑,感觉有点太晚了。 正文 青岛铁了后就知道自己菜,本来也没对EC-Final报太大的希望,但由于今年的去年的瞎jb规则,导致很多学校的一队二队没办法来打。 知道了这个消息心里还是抱有一定的希望的,对自己而言确实是个很好拿牌的机会(但最后还是没拿到) 热身赛 我校本就在西安,所以先考了四级然后去打的热身赛; 由于这是我第一次打EC-Final,自己是弱校,做坐到自己的位置,各种慌。(如... 阅读详情

相关推荐

Python实战:超分辨率图像质量评估全攻略——PSNR、SSIM、LPIPS与NIQE的代码实现与优化

本文详细介绍了在Python中实现超分辨率图像质量评估的完整方案,涵盖PSNR、SSIM、LPIPS和NIQE四大核心指标。通过模块化代码设计、多进程并行处理和GPU加速优化,帮助开发者构建高效、可扩展的评估系统,并提供了实战避坑指南与结果解读方法。

weixin_29053073的博客 471

【hdu5533】【2015ACM/ICPC亚洲区长春站】Dancing Stars on Me 题意&题解&代码

2015ACM/ICPC亚洲区长春站 几何(暴力)

曾经追梦的happy时光 1万+

从平衡车到寻迹小车:IMU963RA九轴陀螺仪实战避坑与四元数融合指南

本文详细解析了IMU963RA九轴陀螺仪在机器人姿态控制中的应用,重点探讨了从六轴升级到九轴系统的技术路径及四元数融合算法。通过实战案例,揭示了如何利用地磁计补偿陀螺积分漂移,并提供硬件集成、传感器校准及算法实现的完整解决方案,有效将8小时漂移控制在2度以内。

weixin_27219587的博客 253

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛C. Coconut

Coconut is Captain Gangplank’s favourite fruit. That is why he needs to drink coconut juice from bb coconuts each day.On his next trip, he would pass through NN citis.His trip would begin in the 11-st

知足常乐的博客 1123

高通camx架构学习(零)—— 深入理解Camera 硬件抽象层

从上面的定义可以看出,主要是通过hw_module_t 代表了模块,通过其open方法用来打开一个设备,而该设备是用hw_device_t来表示,其中除了用来关闭设备的close方法外,并无其它方法,由此可见谷歌定义的HAL接口,并不能满足绝大部分HAL模块的需要,所以谷歌想出了一个比较好的解决方式,那便是将这两个基本结构嵌入到更大的结构体内部,同时在更大的结构内部定义了各自模块特有的方法,用于实现模块的功能,这样,一来对上保持了HAL的统一规范,二来也扩展了模块的功能。

图像学习之旅 1667

11种图像清晰度评价函数附MATLAB代码

博主的第一篇博客! 本科毕业论文是“基于图像处理的自动对焦技术研究”,对焦过程中的一个重要阶段是图像清晰度评价,博主自己用MATLAB实现了4类清晰度评价函数:基于图像梯度的清晰度评价函数、频域评价函数、信息熵评价函数、统计学评价函数,总计11种。博主之前没有用过MATLAB,完全是本科论文需要,没办法对着别人的代...

kungfu_rabbit的博客 5万+

2017年ACM-ICPC乌鲁木齐站网络赛C题--Coconut

C: Coconut time limit 200ms     memory limit 131072KB Coconut is Captain Gangplank's favourite fruit. That is why he needs to drink coconut juice from b coconuts each day. On his next trip, he w

maozhengxiang的博客 487

基于树莓派4B与NCNN的YOLOv8高效部署实战:无GPU环境下的C++加速优化全流程指南**

本文详细介绍了在树莓派4B上基于NCNN框架部署YOLOv8目标检测模型的全流程。内容包括:从PyTorch模型导出NCNN格式文件、树莓派环境配置(OpenCV和NCNN编译)、C++实现代码解析(含模型加载、推理及后处理),以及实际部署测试结果。在树莓派4B上达到约2FPS,并提供INT8量化、多线程等优化建议。该方案为无GPU设备提供了轻量化目标检测的实用部署方案,适合边缘计算场景。

FJN110的博客 916

2011-ACM/ICPC亚洲区中国大陆5个赛区信息汇集

大连赛区(大连理工大学) 网络赛(DLUT-OJ):2011.09.03 12:00-17:00 现场赛时间:2011.09.24-25 竞赛主页:http://icpc.dlut.edu.cn 上海赛区(复旦大学) 网络赛(HDOJ):2011.09.10 12:00-17:00 现场赛时间:2011.10.15-16 竞赛主页:http://www.cs.fudan....

weixin_34279184的博客 320

基于SVD矩阵分解的用户购物篮预测分析实战

基于SVD矩阵分解的用户购物篮预测分析实战

360

1位2路选择器设计

1位2路选择器设计

好好学习,天天向上 3575

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 A,C,F , H

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛A. BananaBananas are the favoured food of monkeys. In the forest, there is a Banana Company that provides bananas from different places. The company has two lists. The fi

等我红名,我就再也不code了 562

Halcon 形态学 开发案例 (开运算opening(先腐蚀再膨胀)、闭运算closing(先膨胀再腐蚀))

算子方法:功能:使用用户自定义的结构元素对区域进行开运算参数: Region(输入参数) :输入区域 StructElement(输入参数) :结构元素(区域) RegionOpening(输出参数) :开运算后的区域功能:使用圆形结构元素对区域进行开运算参数: Region(输入参数) :输入区域 RegionOpening(输出参数) :开运算后的区域 Radius(输入参数) :圆形结构元素的半径功能:使用矩形结构元素对区域进行开运算。

程序员,他们想的是什么?他们想的永远都是技术,他们崇尚的也永远都是技术。 1618

2017 ACM-ICPC 网络赛 总结

整个九月,就在区域赛网络赛中度过了……8月有多校9月有网络赛,过的十分充实。坚持下来的这两个月,使我提升巨大!成功跨越了一个瓶颈期,现在终于有能力去攻克一些高难度的算法了。平时过得也很开心,最高兴的就是认识了一大堆热爱ACM的小伙伴们。今年大一来了很多大神,希望他们都能坚持下并取得好成绩吧! 我也把我们今年做出来的每一道题包括后来补的题都写了题解发了博客,希望对下一届的小伙伴们有所帮助!

LP_Cong 2586

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛B: Out-out-control cars

问题 B: Out-out-control cars 题目描述 Two out-of-control cars crashed within about a half-hour Wednesday afternoon on Deer Park Avenue. This accident alarmed the district government.It jumpstarted a v...

weixin_30780221的博客 160

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛-A. Banana

Bananas are the favoured food of monkeys.In the forest, there is a Banana Company that provides bananas from different places.The company has two lists.The first list records the types of bananas prefe

知足常乐的博客 7871

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

2018 ACM-ICPC亚洲区域赛 北京赛区

2018 ACM-ICPC亚洲区域赛 北京赛区 A题 #include &amp;amp;amp;lt;iostream&amp;amp;amp;gt; #include &amp;amp;amp;lt;vector&amp;amp;amp;gt; #include &amp;amp;amp;lt;string.h&amp;amp;amp;gt; #include&amp;amp;amp;lt;map&amp;amp;amp;gt; using

紫芝的博客 795

2018年ACMICPC亚洲区域赛南京赛区总结

2018年ACMICPC亚洲区域赛南京赛区总结 首先我认为我们可以 A5题 A题因为题意读错,导致WA了一发 J题我不会写,但是小飞想出来了怎么写,但是我没听懂,但我相信他,他去写了1A。 I题全场最崩的一题,首先我抄了个网络流的板子,但是样例都没过,小飞开始写Dinic,后来样例过了,但是交上去WA了,从此这道题就开始改。知道最后二十分钟发现题意出问题了,最后也没过。 G题全场第二崩,第四项...

wang563681252的博客 1422

第43届ACM亚洲区域赛(青岛)总结

从网络赛拿到名额的时候,就一直在训练,差不多训练了1个半月吧。实力也有所增长,但由于学校停电的原因,期间一直没打cf,只刷着Bin聚的专题,可能见到的题型少,遇到问题不能马上量化为熟悉的问题; 关于青岛 【青岛站附近的栈桥】 第一次来打区域赛,感觉其他高校的环境真好啊,坐了大概1个小时的公交来到了中国石油大学,这里不得不吐槽青岛的公交,真的是拥挤啊!!!硬生生的站了一个小时,腿都站麻了!!! ...

Hang_ccccc的博客 2898

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛A题 : BananaC题 : Coconut

我家有个zz~ 4053

Islands(2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 F)

Problem Description On the mysterious continent of Tamriel, there is a great empire founded by human. To develope the trade, the East Empire Company is set up to transport goods from place to place...

Alex_McAvoy的博客 382

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 F. Islands(有向图加边变成一个强连通图)

On the mysterious continent of Tamriel, there is a great empire founded by human. To develope the trade, the East Empire Company is set up to transport goods from place to place. Recently, the company wants to start their business in Solstheim, which is

HJY 1444

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 D. Hack Portals(区间DP)

We all have much to be proud of. As a player of the game Ingress, IloveMATH is proud of these portals on the road in front of his campus. Here is a brief introduction of this mobile game. Ingress, a

WZJRJ28 642

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 Banana

签到题 50的规模,随便搞搞都能过,用stl的string的搜索直接做了 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 50; string monkey[maxn+5]; string place[maxn+5]; int n,m; inline char b2...

稻云麦花的博客 345

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 C. Coconut

题目:暂时看不到……有的看了再更新题目信息…… 题意:签到题 解题思路:签到题 #include #include #include #include #include #include #include #include #include #include #include #include #define INF 1<<29 using namespace std;

LP_Cong 804

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 A: Banana

A: Banana time limit 200ms memory limit 131072KB Bananas are the favoured food of monkeys. In the forest, there is a Banana Company that provides bananas from different places. The company h

sxy201658506207的博客 2234
上一篇: POJ 1679 The Unique MST(次小生成树)
下一篇: 2017 ACM-ICPC 亚洲区(沈阳赛区)网络赛 - 02 04 05 08 12
Mr_Treeeee
博客等级 码龄10年 38粉丝 551原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值