2015-2016 ACM ICPC Baltic Selection Contest [解题报告]

ONNX Runtime 1.15 GPU版打包避坑:PyInstaller 3步解决CUDA DLL缺失问题 本文详细介绍了如何解决ONNX Runtime 1.15 GPU版打包时遇到的CUDA DLL缺失问题,通过PyInstaller三步操作确保动态库正确包含。文章提供了完整的部署指南、版本兼容性建议和疑难排错技巧,帮助开发者高效完成深度学习模型部署。 阅读详情

新地址链接

A题:AHB 水题,直接上代码:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long Long;
const int maxn = 1e5 + 10;
const int maxm = 256;

int main() 
{
    char s1[20], s2[20];

    while (scanf("%s%s", s1, s2) != EOF)
    {
        int l1 = (int) strlen(s1), l2 = (int) strlen(s2);
        bool flag = false;
        for (int i = 0; i < l1; i++)
        {
            int v1 = s1[i]-'0', v2 = s2[i]-'0';
            int v = max(v1,v2)-min(v1,v2);
            if (v == 0 && !flag)
            {
                continue;
            }
            flag = true;
            printf("%d", v);
        }
        if (!flag) printf("0");     
        puts("");
    }

    return 0;

B题:Wet Boxes 这个题据说是线段树,暂时没做出来

C题: Minimax Tree

题意:

给出一棵n个节点的树,叶节点都有一个value值,其余节点每个节点可以
放上一个max开关或者一个min开关, 如果u是max开关,那么val[u] =
max(val[v]), v是u的子节点,其中min开关和max开关的个数都是给定的,
并且max开关+min开关 = n-叶子节点数,让你安排每个中间节点是max还是min,
输出根节点的最大值和最小值

题解:

因为求最大值和最小值都是一样的方法,所以我们以求最大值来分析,
首先,我们先考虑把最大的叶子节点u传上去,因为u最大,所以,我们
在往上的路径分叉处只能用max开关,为了能让u传上去,肯定应该让不是该路径上的
其他分叉都尽量用min开关以节省max开关,现在我们考虑u的兄弟节点v,如果要把u的兄弟节点
v传上去,因为u比v大,所以我们在u和v的父节点f上肯定用min开关最划算,那么现在我们就把
问题转化成了把f上的节点传到根节点去(即min(u,v))。
所以说:如果当前考虑的节点u够大,那么我们就直接让接下来的路程都用max开关,否则就让他
用min开关传到父节点去。

代码:

#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define vsz(u) ((int) G[u].size())
typedef long long Long;
typedef vector<int>::iterator vIte;
const int maxn = 1e5 + 10;
const int inf = 1e9;
const double eps = 1e-8;

vector<int> G[maxn];
int val[maxn], minv[maxn], maxv[maxn];
int ansmn, ansmx, mn, mx, lev;

void dfs(int u, int judge)
{
    minv[u] = inf; maxv[u] = 0;
    if (vsz(u) == 0)
    {
        minv[u] = maxv[u] = val[u];
    }
    for (vIte it = G[u].begin(); it != G[u].end(); ++it)
    {
        dfs(*it, judge+(vsz(u)!=1));
        minv[u] = min(minv[u], minv[*it]);
        maxv[u] = max(maxv[u], maxv[*it]);
    }
    if (judge <= mx) ansmx = max(ansmx, minv[u]);
    if (judge <= mn) ansmn = min(ansmn, maxv[u]);
}
int main() 
{
    int n, k;

    while (scanf("%d%d",&n, &k) != EOF)
    {
        for (int i = 0; i < maxn; i++)
        {
            G[i].clear();
        }
        for (int i = 2; i <= n; i++)
        {
            int p; scanf("%d", &p);
            G[p].push_back(i);
        }
        int zero = 0;
        for (int i = 1; i <= n; i++)
        {
            scanf("%d", &val[i]);
            zero += !val[i];
        }
        mn = k, mx = zero-k, lev = n-zero;
        ansmn = inf; ansmx = 0;
        dfs(1, 0);
        printf("%d %d\n", ansmn, ansmx);
    }

    return 0;
}

D题:Journey

给一个n*m的矩阵,由.和#组成,要从左上角走到右下角的花费,其中
奇数步的花费为a,偶数步的花费为b, 直接先求从左上角到右下角的最短路step
然后答案就是step/2*(a+b) + (step&1),因为第一步是奇数步。

代码:

#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;

const int maxn = 507;
int n, m;
int dire[][2] = { {-1,0},{1,0},{0,-1},{0,1} };
char mapp[maxn][maxn];
bool vis[maxn][maxn];
struct Data 
{
    int x, y, step;
    Data() {}
    Data(int x1, int y1, int step1) {x = x1, y = y1, step = step1;}
}cur;
queue<Data> que;
bool safe(int x, int y) {
    if (0 <= x && x < n && 0 <= y && y < m) return true;
    return false;
}
int bfs() {
    memset(vis, false, sizeof(vis));
    while (!que.empty()) que.pop();
    que.push(Data(0,0,0));
    vis[0][0] = true;
    while (!que.empty()) {
        cur = que.front();
        que.pop();
        if (cur.x == n-1 && cur.y == m-1) return cur.step;
        for (int i = 0; i < 4; i++) {
            int x = cur.x + dire[i][0], y = cur.y + dire[i][1];
            if (safe(x, y)) {
                if (mapp[x][y] != '#' && !vis[x][y]) {
                    que.push(Data(x,y,cur.step+1));
                    vis[x][y] = true;
                }
            }
        }
    }
    return -1;
}
int main() {
    while (scanf("%d%d", &m, &n) != EOF) {
        int a, b;
        scanf("%d%d", &a, &b);
        for (int i = 0; i < n; i++) {
            scanf("%s", mapp[i]);
        }
        int ans = bfs();
        if (ans == -1) printf("IMPOSSIBLE\n");
        else {
            int cost;
            cost = (ans / 2) * (a + b);
            if (ans & 1) cost += b;
            printf("%d\n", cost);
        }
    }
    return 0;
}

E题:Permutation Polygon

给一个n个点,点是1-n顺时针的,n条边的图,问有多少个交点。

建图的时候建立从小点到大点建有向图,然后从小到大扫描每个点,用
树状数组维护即可。

#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
#define pb push_back
const int maxn = 1e5 + 10;
typedef long long Long;
typedef vector<int>::iterator vIte;
Long C[maxn];
int n;
vector<int> G[maxn];

inline int lowbit(int x)
{
    return x&(-x);
}
void add(int x, int v)
{
    while (x <= n)
    {
        C[x] += v;
        x += lowbit(x);
    }
}
Long sum(int p)
{
    Long ret = 0;
    while (p > 0)
    {
        ret += C[p];
        p -= lowbit(p);
    }
    return ret;
}
int main()
{
    scanf("%d", &n);

    for (int i = 1; i <= n; i++)
    {
        int v; scanf("%d", &v);
        G[min(i,v)].pb(max(i,v));
    }
    Long ans = 0;
    for (int i = 1; i <= n; i++)
    {
        add(i,-sum(i));
        for (vIte it = G[i].begin(); it != G[i].end(); ++it)
        {
            ans += sum((*it)-1);
        }
        for (vIte it = G[i].begin(); it != G[i].end(); ++it)
        {
            add(*it,1);
        }
    }
    printf("%I64d\n", ans);

    return 0;
}

F题:Unusual Sum

水题:直接化简一下就ok了:

代码:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long Long;
const int maxn = 1e5 + 10;
const int maxm = 256;


int main() 
{
    int t; scanf("%d", &t);

    while (t--)
    {
        double x, y; scanf("%lf%lf", &x, &y);
        printf("%.10f\n", (y+1-x)/(x*(y+1)));
    }

    return 0;
}

G题:Robot Walk

水模拟:
代码:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define maxn 100005

char str[maxn];
char op[maxn];
char ans[maxn];
int acnt = 0;
int main()
{
    int n, m, x;
    scanf("%d%d", &n, &x);
    scanf("%s", str);
    scanf("%d", &m);
    scanf("%s", op);
    x--;
    ans[acnt++] = str[x];
    for (int i = 0; op[i] != '\0'; i++)
    {
        if (op[i] == 'L') x--;
        else x++;
        ans[acnt++] = str[x];
    }
    ans[acnt] = '\0';
    puts(ans);
    return 0;
}

H题:Game of Corners

水题有点多:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    if (n > m) swap(n, m);
    printf("%I64d\n", (long long)n*(m+1));
    return 0;
}

I题:Shell Game

用前视图看,题目就转化为在一个梯形里面放圆,然后直接二分圆的半径,
看是否能放进去就行了。

#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long Long;
const int maxn = 5e2 + 10;
const double eps = 1e-8;

bool ok(double m, double r, double R, double h)
{
    r*=2; R*=2;
    double seta = atan(h/((R-r)/2.0));
    double afa = atan(m/(R/2.0));
    double bata = seta - afa;
    double edge = sqrt(m*m+(R/2.0)*(R/2.0));
    double ans = edge*sin(bata);
    return ans >= m;
}
int main() 
{
    double r, R, h;

    while (scanf("%lf%lf%lf", &r, &R, &h) != EOF)
    {
        double low = 0, high = h/2.0;

        while (high-low >= eps)
        {
            double mid = (low+high) / 2.0;
            if (ok(mid,r,R,h))
            {
                low = mid;
            }
            else high = mid;
        }
        printf("%.7f\n", low);
    }

    return 0;
}

J题:Narrow Bus

给一个空队列,有n个操作,(1<=n<=1e5), 一是F:从队首进入一个数,
二是B:从队尾进入一个数,三是第O i: 第i个进入的数选择两边中人少的一边出队,
所有在他前方的依次出队,从队列的另一边依次进入,输出地i个人出队的时候,有多少人
要因此出队。用Splay模拟即可

代码:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 1e5 + 10;
const int inf = 1e8;
struct node
{
    int l, r, f, sz, v;
    void clear()
    {
        l = r = f = sz = 0;
    }
} nd[maxn];
int rt, tot;
void init()
{
    tot = 0;
    rt = 0;
}
int newNode() 
{
    nd[++tot].clear();
    return tot;
}
void up(int x)
{
    nd[x].sz = 1;
    if (nd[x].l) nd[x].sz += nd[nd[x].l].sz;
    if (nd[x].r) nd[x].sz += nd[nd[x].r].sz;
}
void r_rorate(int x)
{
    int f = nd[x].f, l = nd[x].l;
    if (nd[f].l == x) nd[f].l = l;
    else nd[f].r = l;
    nd[l].f = f;
    nd[x].l = nd[l].r; nd[nd[x].l].f = x;
    nd[x].f = l; nd[l].r = x;
    up(x);
}
void l_rorate(int x)
{
    int f = nd[x].f, r = nd[x].r;
    if (nd[f].l == x) nd[f].l = r;
    else nd[f].r = r;
    nd[r].f = f;
    nd[x].r = nd[r].l; nd[nd[x].r].f = x;
    nd[x].f = r; nd[r].l = x;
    up(x);
}
void splay(int x, int rootf)
{
    for (; nd[x].f != rootf; )
    {
        int f = nd[x].f, g = nd[f].f;
        if (g == rootf) {
            if (nd[f].l == x)
                r_rorate(f);
            else 
                l_rorate(f);
        }
        else {
            if (nd[g].l == f)
                if (nd[f].l==x) r_rorate(g), r_rorate(f);
                else l_rorate(f), r_rorate(g);
            else
                if (nd[f].r == x) l_rorate(g), l_rorate(f);
                else r_rorate(f), l_rorate(g);
        }
    }
    up(x);
    if (!rootf) rt = x;
}
int getFirst(int x)
{
    for (; nd[x].l; x = nd[x].l) ;
    return x;
}
int getLast(int x)
{
    for (; nd[x].r; x = nd[x].r) ;
    return x;
}
int Gao(int x)
{
    splay(x, 0);
    int ret = inf;
    if (nd[x].l) ret = min(ret, nd[nd[x].l].sz);
    else ret = 0;
    if (nd[x].r) ret = min(ret, nd[nd[x].r].sz);
    else ret = 0;
    if (nd[x].r == 0)
    {
        nd[nd[x].l].f = 0;
        rt = nd[x].l;
        nd[x].l = 0;
        return ret;
    }
    nd[nd[x].r].f = 0;
    int xx = getLast(x);
    splay(xx, 0);
    nd[xx].r = nd[x].l;
    if (nd[x].l) nd[nd[x].l].f = xx;
    if (nd[x].l) splay(nd[x].l, 0);
    nd[x].r = 0;
    return ret;
}
int main()
{
    int n;
    while (scanf("%d", &n) != EOF)
    {
        init();
        nd[0].clear();
        for (int i = 0; i < n; i++)
        {
            nd[0].l = nd[0].r = 0;
            char cmd[3]; scanf("%s", cmd);
            if (cmd[0] == 'F')
            {
                int id = newNode();
                int x = getFirst(rt);
                splay(x, 0);
                if (x) nd[x].l = id;
                nd[id].f = x;
                splay(id, 0);
            }
            else if (cmd[0] == 'B')
            {
                int x = getLast(rt);
                int id = newNode();
                splay(x, 0);
                if (x) nd[x].r = id;
                nd[id].f = x;
                splay(id, 0);
            }
            else
            {
                int id; scanf("%d", &id);
                printf("%d\n", Gao(id));
            }
        }
    }
    return 0;
}

K题: Profact

1e5组数据,输入一个a(1<=a<=1e18),问a是否能用若干个阶乘的乘积得到。

因为20的阶乘就已经超过了1e18,直接把所有的组合情况放进set,然后二分查找即可。

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
#define LL long long
#define INF 1e18
LL num[20];
set<LL> Set;
void solve(LL x, int s)
{
    for (int i = s; i<20; i++)
    {
        if (INF/x < num[i]) return;
        Set.insert(x*num[i]);
        solve(x*num[i], i);
    }
}
void init()
{
    num[1] = 1;
    for (int i = 2; i<20; i++)
        num[i] = num[i-1]*i;
    Set.insert(1);
    solve(1, 2);
}
int main()
{
    init();
    int t;
    scanf("%d", &t);
    while (t--)
    {
        LL x;
        scanf("%I64d", &x);
        if (Set.find(x) != Set.end()) puts("YES");
        else puts("NO");
    }
    return 0;
}

L题: Emoticons

水模拟

{% highlight c++ %}
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn = 1e5+7;
char str[maxn];
int main() {
    int n;
    while (scanf("%d", &n) != EOF) {
        scanf("%s", str);
        int sm = 0, sa = 0;
        for (int i = 0; i < n; i++) {
            if (str[i] == ':') {
                if (i - 1 >= 0) {
                    if (str[i-1] == '(') sm++;
                    if (str[i-1] == ')') sa++;
                }
                if (i + 1 < n) {
                    if (str[i+1] == '(') sa++;
                    if (str[i+1] == ')') sm++;
                }
            }
        }
        if (sm > sa) printf("HAPPY\n");
        else if (sm < sa) printf("SAD\n");
        else printf("BORED\n");
    }
    return 0;
}
【26美赛D题】2026美赛数学建模(MCM/ICM)思路解析及代码分享 2026美赛D题数学建模竞赛思路解析摘要:本文针对美赛D题提供系统性解决方案,提出四层建模框架(数据层、机理层、模型层、决策层),强调逻辑闭环比模型复杂度更重要。包含通用建模步骤:指标体系构建、状态评估、动态预测和策略优化,并给出Python基础代码框架。论文建议采用七段式结构,突出从现实问题到决策方案的完整闭环。核心在于通过数据驱动方法揭示问题规律,结合多源数据整合、系统行为建模和风险评估,最终形成可落地的决策建议,体现数学建模解决实际问题的能力。 阅读详情

相关推荐

从一个过气考渣的角度看LLM智能化测试用例生成

根据业务需求生成测试用例,会涉及到相关上下文的召回、用例生成等场景。除了用例生成之外,也可以考虑应用LLM进行用例评审。因此,本文将涉及以下内容。

software_test010的博客 829

2015-2016 ACM ICPC Baltic Selection Contest E. Permutation Polygon

题目描述:http://codeforces.com/gym/100796/problem/E题解:其实很裸的一道题. 对于i和p[i],我们考虑在i和p[i]之间,但是值却在它之外的,那么和他相交. 同时,为了便于计算,我们也可以算在1~i和p[i]~n的值在i到p[i]的个数, 这个很简单,我们分成两段,左边推一次,右边推一次,用树状数组.然后结束 但是注意:要将二元组i和p[i]同时放

ruclion的专栏 868

从零开始:Doherty功率放大器的ADS仿真实践指南

本文详细介绍了Doherty功率放大器在ADS中的仿真设计流程,从基础原理到实际工程应用。通过负载调制技术,Doherty结构显著提高了功率放大器的效率,特别适合处理高峰均比信号。文章包含ADS环境搭建、对称与非对称设计、常见问题调试等实用内容,为射频工程师提供全面的实践指南。

weixin_29313547的博客 689

2015-2016 ACM ICPC Baltic Selection Contest C Minimax Tree

题目描述:http://codeforces.com/gym/100796/problem/C题解:很好的一道题目. 正着做是树形dp,显然n太大. 我们习惯性的反着考虑,看一个值能不能成为最小值. 那么最小的那个只需要到根的距离的min就能够保证(1). 那次小的呢?就是在和比它大的汇合的时候一定要取一次min, 那么我们搞lca,在这里取min一定是最好的. 那么发现(1)也不准确了,

ruclion的专栏 440

制造业与工业知识图谱应用

在全球数字化转型背景下,制造业面临创新周期缩短、质量管控精细化等挑战。知识图谱技术通过结构化表示工业知识,为智能制造提供关键技术支撑。工业知识图谱具有专业性强、多源异构数据融合、实时性要求高等特点,其构建流程涵盖本体设计、知识抽取与整合等环节。研究显示,知识图谱与大模型结合可提升工业场景的智能化水平,在设备故障诊断、供应链优化等领域具有显著应用价值。该技术有望成为制造业数字化转型的核心驱动力。

分享一些感兴趣的技术方面 1441

基于YOLOv8深度学习的火焰与烟雾检测系统详解:UI界面 + YOLOv8 + 数据集的实现

通过自动化检测火焰和烟雾,可以提高响应速度,减少潜在的火灾损失,保障人身和财产安全。此外,应用还会显示标记了检测框的视频画面,方便用户直观了解检测效果。同时,前端界面将使用Streamlit来实现,因其可以快速搭建交互式应用,适合我们的需求。要训练一个有效的火焰和烟雾检测模型,我们需要一个包含火焰和烟雾图片的数据集。为了保证模型的准确性和泛化能力,建议收集至少500张火焰和烟雾的图片,保证数据的多样性和代表性。训练过程中,模型会输出每个Epoch的训练损失和验证准确率,便于我们监控模型的学习情况。

YOLO 1321

2015-2016 ACM ICPC Baltic Selection Contest K. Profact

题目描述:http://codeforces.com/gym/100796/problem/K题解:水题,但是还是傻了一会. 最开始一定会想,从大的可以整除的阶层往下除.但这是不对的. 比如fac[17]和fac[18], 不知道要不要除18,但是推一下就能发现,只有17 18 和 13 14 15 需要特殊考虑,其他的都是只除到那个质数就行了. 注意,一定是质数,不能多除重点:1.发现不定情况很

ruclion的专栏 515

Unity与iOS原生交互实战指南

C#(DllImport) → C 接口(extern "C") → Objective‑C / SwiftObjective‑C → UnitySendMessage → C#(GameObject + public 方法)在写.mm文件;在里面写;C# 用声明;调用它,参数就是 string / 数值等;在.mm里做你想做的 iOS 原生操作。在 Unity 里准备一个常驻 GameObject,比如;上面挂一个脚本,写;在 iOS 插件中用;

本博客聚焦游戏开发技巧、创业实战心得及大学热门课程干货。这里既有技术深度,也有思维广度,无论你是开发者、创业者还是高校学子,都能在这里找到适合自己的成长之路! 1357

2015-2016 ACM ICPC Baltic Selection Contest

  这是上礼拜三的训练赛,以前做过一次,这次仅剩B题没补。题目链接:https://vjudge.net/contest/153192#overview。   A题,水题。   C题,树形DP,其实是一个贪心问题,比如要取max的话,从根往下的肯定是要依次放max门,因此取一条能够获得最大值的一路放下max门即可。min同理。   D题,BFS即可。   E题,从小点到大点建边,...

ddmxynl793173的博客 211

WiFi偏门协议(四):增强的传输机制802.11aa

区分Unicast和Multicast的优先级,以及设定不同的重传次数,以细化EDCA机制。 SCS(StreamClassification Service) 如上图,在VI,VO内各自又增加了一个queue, 对应不同的MAC header。VI和VO内的两个queue可以分别对应UC和MC。这样就提供了同一个AC内的更细粒度的优先级区分。当然还可以使用Drop Eligibility Indication子域来区分不同的重传次数。 改善Multicast数据传...

reekyli的专栏 1790

cesium 深度图(获取区域最高最低点位)

文章摘要: Cesium深度图技术可用于获取区域地形高程数据,核心实现步骤包括:1)通过离屏相机构建独立渲染环境,使用正交投影确保采样精度;2)采用离屏渲染技术获取均匀分布的地形点数据。关键技术点包含多边形外包矩形计算、后台相机配置(5km高度正交投影)、1024×1024像素离屏视图设置,以及深度数据解析(RGBA格式转换和三维坐标还原)。该方法避免了主视图干扰,可精准获取区域内地形高程信息,为填挖方分析等应用提供基础数据支持。

God's asylum的博客 283

Gym - 100796K Profact 阶乘的乘积 DFS+剪枝

2015-2016 ACM ICPC Baltic Selection Contest K. Profact time limit per test:1 second memory limit per test:256 megabytes Alice is bored out of her mind by her math classes. She crave

富士山下 991

【数据集】米级别热红外卫星合集:SDGSAT-1、HotSat-1等

米级别热红外卫星合集:SDGSAT-1、HotSat-1等

WW、forever的博客 1250

Gym - 100796I Shell Game 计算几何

2015-2016 ACM ICPC Baltic Selection Contest I. Shell Game time limit per test:1 second memory limit per test:256 megabytes Bob has discovered a new quality in himself — he likes to t

富士山下 595

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

2015-2016 ACM-ICPC Blur

题目地址:http://codeforces.com/gym/100819/attachments题目:You have a black and white image that is w pixels wide and h pixels high. You decide to representthis image with one number per pixel: black is 0, a...

做题记录 305

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

2015-2016 ACM-ICPC Grid

题目地址:http://codeforces.com/gym/100819/attachments题目:You are on the top left square of an m × n grid, where each square on the grid has a digit on it.From a given square that has digit k on it, a move ...

做题记录 430

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

hdu 2771(uva 12171) Sculpture bfs+离散化

题意: 给出一些边平行于坐标轴的长方体,这些长方体可能相交,也可能相互嵌套,这些长方体形成了一个雕塑,求这个雕塑的总体积和表面积。 题解: 最容易想到直接进行bfs或者dfs统计,但此题的麻烦之处在于求整个雕塑的外表面积和雕塑内部可能出现四个长方体所搭成的空心,空心不能计算到表面积中,但是计算总体积却要计入,于是直接bfs或者dfs不好处理,于是,可以想到直接统计整个雕塑外围的所有小方块,即

myHelperIsMe的专栏 2313

codeforces GYM 100792H

题意:给出n个1个字节的数(1<=n<=100000),用16进制的形式给出,每个数的范围00-FF, 找出一个子序列s, 使得0^s[0]+1^s[1]+2^s[2]+…k^s[k]的和最大,输出这个最大值。第一步:首先很容易想到一个简单的dp方程 dp[i][j] = max(dp[i-1][j], dp[i-1][j-1]+(arr[i]^j)) dp[i][j]:代表前i个数一共选了j

myHelperIsMe的专栏 1386

uva 11853 Paintball dfs找连通块

题意: 给出一个矩形湖, 湖里面有一些圆形地小岛, 问能否从左岸乘船到达右岸,如果能,找出最上面的起点和终点。 题解: 如果能从左岸到达右岸,那么一定不能存在一个连通的岛屿从上岸连到下岸, 所以直接从上到下做dfs,判断是否存在从上岸到下岸地连通块,完成判断。那么接下来就是如何找出最上方地点了,画画图便发现,对于起点,如果存在跨越上岸和左岸地连通岛屿,那么起点一定只能在左岸地交点下方,所以,

myHelperIsMe的专栏 1357

uvalive 6393(uva 1572) Self-Assembly 拓扑排序

题意: 给出一些正方形,这些正方形的每一条边都有一个标号,这些标号有两种形式:1.一个大写字母+一个加减号(如:A+, B-, A-......), 2.两个0(如:00);这些正方形可以随意翻转和旋转,当两个正方形通过旋转或翻转,使得他们的公共边为相同大写字母并且符号相反时,他们就可以彼此结合拼在一起,现在给出n中正方形,每种正方形有无限多种,问这些正方形能否拼成一个无限大的结构。 题解:

myHelperIsMe的专栏 1142

codeforces 593D 树链剖分

题目链接 给出一棵树,每棵树有value值,两种操作:1 u v x, 用x依次除以u到v路径上的数,然后 输出x,2 p x, 把第p条边的权值改为x. 直接树链剖分,然后用线段树维护乘积即可。注意 乘积可能爆long long , 可以用inf/a如果#include <cstdio> #include <cstring> #include <algorithm> #define lson

myHelperIsMe的专栏 1038

Acdream 1424 Diversion 树链剖分+线段树

题意: 给定n个城市,和一些道路,道路有两种,一种是石头路,还有一种是乡村路,石头路形成了一棵树,即两两城市都可达,乡村路的加入使所有的石头路都处于一个或多个环中,即任意石头路被破坏后,城市间依然可以通过乡村路连通,现在敌国可以破坏一条石头路和一条乡村路,问,有多少种破坏方案,可以使破坏后,至少有一对城市不能互相到达。 题解: 仔细想想可以发现,石头路形成了一棵树,当这棵树上某一段道路被乡村

myHelperIsMe的专栏 979

hdu 1044 Collect More Jewels 解题报告 + 状态压缩分析

fd

myHelperIsMe的专栏 973

codeforces 593B Anton and Lines

题意:给出n条直线(1<=n<=1e5),问你在(x1,x2)这个区间是否存在交点当n = 1明显没有交点,NO当n = 2: 如下图其中a1为直线L1与x1的交点,b1为直线L1与x2的交点,可以发现如果两条直线要 在(x1,x2)之间相交,那么必须满足a1当n = 3:新博客地址我们发现如果L3与L1在(x1,x2)有交点,那么L3与L2在(x1,x2)必有交点,所以 所以,这种情况,我们只

myHelperIsMe的专栏 939

hdu 3810 Magina 队列模拟0-1背包

题意: 出一些独立的陆地,每片陆地上有很多怪物,杀掉每个怪物都需要一定的时间,并能获得一定的金钱,给出指定的金钱m, 求最少要多少时间可以得到m金钱,仅能选择一个陆地进行杀怪。 题解: 这题,如果不管数据范围,很容易想到对每片陆地求一次0-1背包(dp(i, j) = min(dp(i-1, j), dp[i-1, j-money] + time), i 为金钱),然后在所有陆地中找出最少的

myHelperIsMe的专栏 937

uva 12730 Skyrk's Bar 递推

题意: 给出n, 和 k(

myHelperIsMe的专栏 927
上一篇: codeforces GYM 100792H
下一篇: codeforces 593D 树链剖分
吃掉吃掉
博客等级 码龄12年 7粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值