zoukankan      html  css  js  c++  java
  • 16年湖南训练赛,全是语文题

    http://blog.csdn.net/cww97?viewmode=contents

    湖南省多校对抗赛(2016.03.06) [Cloned]

    https://vjudge.net/contest/182059#overview

    题没啥难度,读题半小时

    这里写图片描述

    C

    题意是给个字符串。全是大写。问你要把这个字符串变成PERPERPER。。。

    要替换多少个,看懂题意就可以秒了,签到题

    F

    题意:f个轨道,每个轨道可以任选起点,每次滑行一段距离,中间可以停顿,但是滑行中不能有停顿,轨道滑到头必须掉头,掉头需要1单位时间的停顿,中途可以随时掉头(当然也要停顿),也可以任意时刻停顿、

    在这停顿,问是否可以在规定时间段内连续滑行

    滚动数组更新n次

    md一开始看时限20s,oxx说,写个大暴力,2的100次方,娘的20s,这个复杂度20年跑的完吗

    #include <cstdio>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    const int N = 111;
    const int M = 1e4 + 7;
    const int dx[] = {-1, 1};
    int a[N], n, m;
    
    bool vis[2][M];
    bool check(){
        memset(vis, 1, sizeof(vis));
        int u = 0;
        for (int i = 0; i < n; i++){
            //printf("i = %d
    ", i);
            for (int j = 0; j <= m; j++) vis[u^1][j] = 0;
            for (int j = 0; j <= m; j++) if (vis[u][j]){
                //printf("j = %d
    ", j);
                for (int k = 0; k < 2; k++){
                    int p = j + dx[k] * a[i];
                    if (0<=p && p<=m) vis[u^1][p] = true;
                }
            }
            u ^= 1;
        }
        for (int i = 0; i <= m; i++) if (vis[u][i]) return true;
        return false;
    }
    
    int main(){
        //freopen("in.txt", "r", stdin);
        int f, x, y;
        bool poss = 1;
        for (scanf("%d", &f); f--;){
            scanf("%d%d", &m, &n);
            for (int i = 0; i < n; i++){
                scanf("%d%d", &x, &y);
                a[i] = y - x;
                if (a[i] > m) poss = 0;
            }
            if (!poss) continue;
            if (!check()) poss = 0;
        }
    
        if (poss) puts("possible");
        else puts("impossible");
        return 0;
    }
    

    G

    题意:

    皇家花园有好多哥布林,偷果子,守护者打开了喷水装置,哥布林怕水就撤了

    每个哥布林在一个坐标上,每个喷水装置有坐标和喷水半径

    未被喷到的哥布林不会撤退,问最后还剩多少个哥布林

    做法:

    不是很严谨,极限数据是很容易卡这个算法,

    对哥布林按x坐标排序,对每个圆查r-x到r+x范围内的哥布林,然后删去

    用multiset来存,每次操作为log的复杂度,删除也方便

    几万年没写multiset,大部分时间都用在了查文档上

    吐槽:本来哥布林用x和y双关键字排序,蜜汁wa,改的更粗暴之后反而蜜汁过了

    #include <set>
    #include <cstdio>
    #include <iostream>
    using namespace std;
    const int N = 1e5 + 7;
    int n;
    
    int sqr(int x){return x*x;}
    struct point{ // Goblin
        int x, y;
        point (int _x, int _y):x(_x),y(_y){}
        bool operator < (const point &b) const{
            return x < b.x;
        }
        bool in(int cx, int cy, int r){
            return sqr(cx-x) + sqr(cy-y) <= sqr(r);
        }
        inline void print(){
            printf("(%d, %d)
    ", x, y);
        }
    };
    
    multiset <point> po;
    multiset <point>::iterator L, R, it;
    
    int main(){
        //freopen("in.txt", "r", stdin);
        int x, y, r, m;
        scanf("%d", &n);
        po.clear();
        for (int i = 1; i <= n; i++){
            scanf("%d%d", &x, &y);
            po.insert(point(x, y));
        }
    
        scanf("%d", &m);
        for (; m--;){
            scanf("%d%d%d", &x, &y, &r);
            L = po.lower_bound(point(x - r - 1, 0));
            R = po.lower_bound(point(x + r + 1, 0));
            //if (R == po.end()) R--;
            //point p = *R; p.print();
    
            //puts("-----");
            for (; L != R;){
                point p = *L; //p.print();
                it = L;
                L++;
                if (p.in(x, y, r)) {
                    //p.print();
                    po.erase(it);
                }
                //printf("size = %d
    ", po.size());
            }
        }
        printf("%d
    ", po.size());
        return 0;
    }

    剩下的,没看题

  • 相关阅读:
    ERROR 000732:Output Geodatabase:Dataset Database ConnectionsConnection to localhost.sdeSDE.Dataset does not exist or is not supported
    【转】通过 INotifyPropertyChanged 实现观察者模式
    Fatal NI connect error 6413的解决办法 http://www.itpub.net/thread-107518-1-1.html
    Oracle impdp的ignore及 fromuser / touser 功能
    进度条插件使用demo
    两个div并列居中显示——当display:inline-block;时,两个div无法对齐即一高一矮
    两个div并列居中显示——当display:inline;时,div的宽高不起作用即两个div重叠显示
    轮播插件unslider.min.js使用demo
    WEB网页如何让背景图片跟随可视窗口自适应大小
    火狐浏览器不支持location.reload()(以改变页面大小时重新刷新页面为例)
  • 原文地址:https://www.cnblogs.com/cww97/p/12349348.html
Copyright © 2011-2022 走看看