对于偶自己来说,比赛时。。。偶只会做4个。。。。

1001:偶有幸遇到了师母= =,特判8个角,然后15数码逆序判定。。。

1002:首先离散化,然后每种x,每种y都只需要覆盖一次就可以了,每个点也仅会覆盖一次,查x和y时二分一下就可以了。。。O(N+N+N)。。

1003:gsb童鞋搞的= =。

1006:不就是个哈密尔顿回路么。。。处理可能要麻烦一点点,没时间写了。。。

1007:线段树啊~开方运算使数字下降的很快,下降到1或者数字是0以后就不用再下降了,开个布尔数组标记一下就行~

1008:奶奶个熊,今天的比赛就吊死在这题上边了。。。一直在用搜索+剪枝做,然后就一直TLE,到最后一算,我擦,所有的最小公倍数组合总共不到40000种,直接dp打表输出不就行了么。。。。这时候比赛还有不到半小时,时间应该够了,结果我sb的在某个语句想当然的弄错了序,接着又把llg写成了int。。。。悲剧到最后没交上。。。。

1001:

View Code

#include<iostream>#include<cstdlib>#include<cstdio>#include<string>#include<cstring>#include<cmath>using namespace std;const int dx[4] = {-1, 0, 0, 1};const int dy[4] = {0, -1, 1, 0};const int px[24] = {0, 0,1, 1, 1, 1, 1, 1,2, 2, 2, 2,3, 3, 3, 3,4, 4, 4, 4, 4, 4,5, 5};const int py[24] = {1, 4,0, 1, 2 ,3, 4, 5,1, 2, 3, 4,1, 2 ,3 ,4,0, 1, 2, 3, 4, 5,1, 4};const int ex[8] = {0, 0, 1, 1, 5, 5, 4, 4};const int ey[8] = {1, 4, 0, 5, 1, 4, 0, 5};int s[6][6], t[6][6];int f[100], g[100];bool check[6][6];int n;void pre(){    memset(check, 0, sizeof(check));for(int i = 1; i <= 4; i++)for(int j = 1; j <= 4; j++)            check[i][j] = true;    check[0][1] = check[0][4] = true;    check[1][0] = check[1][5] = true;    check[4][0] = check[4][5] = true;    check[5][1] = check[5][4] = true;}void init(){     memset(s, -1, sizeof(s));     memset(t, -1, sizeof(t));int x;for(int i = 0; i < 24; i++)     {         cin>>x;         s[px[i]][py[i]] = x;     }for(int i = 0; i < 24; i++)     {         cin>>x;         t[px[i]][py[i]] = x;     }}bool solve(){int x, y, X, Y;for(int i = 0; i < 8; i++)     {         x = ex[i];         y = ey[i];if(s[x][y] == 0)         {for(int k = 0; k < 4; k++)             {                 X = x + dx[k];                 Y = y + dy[k];if(check[X][Y])                 {int temp = s[x][y];                     s[x][y] = s[X][Y];                     s[X][Y] = temp;break;                 }             }         }if(t[x][y] == 0)         {for(int k = 0; k < 4; k++)             {                 X = x + dx[k];                 Y = y + dy[k];if(check[X][Y])                 {int temp = t[x][y];                     t[x][y] = t[X][Y];                     t[X][Y] = temp;break;                 }             }         }if(s[x][y] != t[x][y]) return false;     }int tot_s = 0, tot_t = 0;for(int i = 1; i <= 4; i++)for(int j = 1; j <= 4; j++)         {             f[(i - 1) * 4  + j] = s[i][j];             g[(i - 1) * 4  + j] = t[i][j];         }

for(int i = 1; i <= 16; i++)for(int j = 1; j < i; j++)         {if(f[j] > f[i]) tot_s ++;if(g[j] > g[i]) tot_t ++;         }for (int i = 1; i <= 16;i++)     {if (f[i] == 0)  tot_s = tot_s + (i - 1) / 4 + (i - 1) % 4;if (g[i] == 0)  tot_t = tot_t + (i - 1) / 4 + (i - 1) % 4;     }     tot_s %= 2;     tot_t %= 2;if(tot_s == tot_t) return true;else return false;}int main(){int T;    scanf("%d", &T);    pre();for(int i = 1; i <= T; i++)    {        init();if(solve()) puts("N");else puts("Y");    }return 0;}

  

1002:

View Code

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

const int N = 100010;

typedef long long llg;

struct node{int x, y, id;}p[N];

vector < vector <int> > gx(N);vector < vector <int> > gy(N);

int n, m, lx, ly, tmpx[N], tmpy[N];bool visx[N], visy[N], visit[N];

bool cmp1(const node &a, const node &b){return  a.x < b.x;}

bool cmp2(const node &a, const node &b){return  a.y < b.y;}

int dealx(int d){bool flag = false;int l, i, r, mid, len, ans = 0, v;    l = 0, r = lx;while(l <= r)    {        mid = (l+r) >> 1;if(tmpx[mid] == d)        {            flag = true;break;        }else  if(tmpx[mid] > d)  r = mid-1;else  l = mid+1;    }if(flag && !visx[mid])    {        len = gx[mid].size();for(i = 0; i < len; i++)        {            v = gx[mid][i];if(!visit[v])            {                visit[v] = true;                ans++;            }        }        visx[mid] = true;    }return  ans;}

int dealy(int d){bool flag = false;int l, i, r, mid, len, ans = 0, v;    l = 0, r = ly;while(l <= r)    {        mid = (l+r) >> 1;if(tmpy[mid] == d)        {            flag = true;break;        }else  if(tmpy[mid] > d)  r = mid-1;else  l = mid+1;    }if(flag && !visy[mid])    {        len = gy[mid].size();for(i = 0; i < len; i++)        {            v = gy[mid][i];if(!visit[v])            {                visit[v] = true;                ans++;            }        }        visy[mid] = true;    }return  ans;}

int main(){int i, c, d, ct;    freopen("data.txt", "r", stdin);while(scanf("%d%d", &n, &m) != EOF)    {if(n==0 && m==0)  break;for(i = 0; i < n; i++)        {            scanf("%d%d", &p[i].x, &p[i].y);            p[i].id = i;            tmpx[i] = p[i].x;            tmpy[i] = p[i].y;        }        sort(tmpx, tmpx+n);        sort(tmpy, tmpy+n);        lx = 0;for(i = 1; i < n; i++)if(tmpx[i] != tmpx[lx])                tmpx[++lx] = tmpx[i];        ly = 0;for(i = 1; i < n; i++)if(tmpy[i] != tmpy[ly])                tmpy[++ly] = tmpy[i];        memset(visx, false, sizeof(visx));        memset(visy, false, sizeof(visy));        memset(visit, false, sizeof(visit));for(i = 0; i <= lx; i++)            gx[i].clear();for(i = 0; i <= ly; i++)            gy[i].clear();        sort(p, p+n, cmp1);        ct = 0;        gx[0].push_back(p[0].id);for(i = 1; i < n; i++)        {if(p[i].x == p[i-1].x)                gx[ct].push_back(p[i].id);else            {                ct++;                gx[ct].push_back(p[i].id);            }        }        sort(p, p+n, cmp2);        ct = 0;        gy[0].push_back(p[0].id);for(i = 1; i < n; i++)        {if(p[i].y == p[i-1].y)                gy[ct].push_back(p[i].id);else            {                ct++;                gy[ct].push_back(p[i].id);            }        }for(i = 0; i < m; i++)        {            scanf("%d%d", &c, &d);if(c == 0)  printf("%d\n", dealx(d));else  if(c == 1)                printf("%d\n", dealy(d));        }        printf("\n");    }return 0;}

  

1007:

View Code

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

const int N = 100100;

typedef long long llg;

int n, m;llg num[N], tree[N<<2];bool yes[N<<2];

void build(int u, int l, int r){int tmp = u<<1, mid = (l+r)>>1;if(l == r)    {        tree[u] = num[l];return;    }else    {        build(tmp, l, mid);        build(tmp+1, mid+1, r);        tree[u] = tree[tmp] + tree[tmp+1];    }}

void Insert(int u, int l, int r, int a, int b){int tmp = u<<1, mid = (l+r)>>1;if(l==a && r==b)    {if(yes[u])  return;else        {if(a == b)            {                llg xx = (llg)sqrt(tree[u]*1.0);if(xx == tree[u])  yes[u] = true;else  tree[u] = xx;                num[a] = xx;return;            }            Insert(tmp, l, mid, a, mid);            Insert(tmp+1, mid+1, r, mid+1, b);            tree[u] = tree[tmp] + tree[tmp+1];if(yes[tmp] && yes[tmp+1])                yes[u] = true;        }    }else    {if(b <= mid)  Insert(tmp, l, mid, a, b);else  if(a > mid)  Insert(tmp+1, mid+1, r, a, b);else        {            Insert(tmp, l, mid, a, mid);            Insert(tmp+1, mid+1, r, mid+1, b);        }        tree[u] = tree[tmp] + tree[tmp+1];if(yes[tmp] && yes[tmp+1])            yes[tmp] = true;    }}

llg Sum(int u, int l, int r, int a, int b){int tmp = u<<1, mid = (l+r)>>1;    llg ans = 0;if(l==a && r==b)    {return  tree[u];    }else    {if(b <= mid)  ans = Sum(tmp, l, mid, a, b);else  if(a > mid)  ans = Sum(tmp+1, mid+1, r, a, b);else        {            ans += Sum(tmp, l, mid, a, mid);            ans += Sum(tmp+1, mid+1, r, mid+1, b);        }return  ans;    }}

int main(){int i, Case = 0, t, x, y;    llg ans;while(scanf("%d", &n) != EOF)    {for(i = 1; i <= n; i++)  scanf("%I64d", num+i);        build(1, 1, n);        memset(yes, false, sizeof(yes));        scanf("%d", &m);        printf("Case #%d:\n", ++Case);for(i = 0; i < m; i++)        {            scanf("%d%d%d", &t, &x, &y);if(x > y)  swap(x, y);if(t == 0)  Insert(1, 1, n, x, y);else            {                ans = Sum(1, 1, n, x, y);                printf("%I64d\n", ans);            }        }        printf("\n");    }return 0;}

  

1008:

View Code

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

typedef long long llg;

int N;llg m, ans, lc[46][40000], dp[46][40000];

llg gcd(llg a, llg b){if(b == 0)  return  a;else  return  gcd(b, a%b);}

llg lcm(llg x, llg y){return  x/gcd(x,y)*y;}

int Find(int lab, llg x){int l, r, mid;    l = 1, r = lc[lab][0];while(l <= r)    {        mid = (l+r) >> 1;if(lc[lab][mid] == x)  return  mid;else  if(lc[lab][mid] > x)  r = mid-1;else  l = mid+1;    }return  -1;}

int main(){int T, i, j, pos, Case = 0;    llg x;set <llg> hash;    hash.clear();    hash.insert(1);set <llg> ::iterator it;for(i = 2; i <= 40; i++)    {        lc[i][0] = 0;for(it = hash.begin(); it != hash.end(); it++)        {            x = *it;            x = lcm(x, i);            hash.insert(x);        }for(it = hash.begin(); it != hash.end(); it++)        {            x = *it;++lc[i][0];            lc[i][lc[i][0]] = x;        }    }    memset(dp, 0, sizeof(dp));    lc[1][0] = 1;    lc[1][1] = 1;    dp[1][1] = 1;for(i = 2; i <= 40; i++)    {        pos = Find(i, i);        dp[i][pos] += 1;for(j = 1; j <= lc[i-1][0]; j++)        {            x = lc[i-1][j];            x = lcm(x, i);            pos = Find(i, x);            dp[i][pos] += dp[i-1][j];        }for(j = 1; j <= lc[i-1][0]; j++)        {            pos = Find(i, lc[i-1][j]);            dp[i][pos] += dp[i-1][j];        }    }    freopen("data.txt", "r", stdin);    scanf("%d", &T);while(T--)    {        scanf("%d%I64d", &N, &m);        ans = 0;        i = lc[N][0];while(lc[N][i]>=m && i>=1)        {            ans += dp[N][i];            i--;        }        printf("Case #%d: %I64d\n", ++Case, ans);    }return 0;}

  

转载于:https://www.cnblogs.com/zxndgv/archive/2011/09/10/2173375.html

谈一下今天的网络赛。。。这次是真的弱爆了。。。。相关推荐

  1. 2020 CCPC网络赛 赛后感

    第一次参加,做过去年19年网络赛的题,去年是四个水题稳做出,然后还有两个线段树和树状数组的题(好像是),所以本来对这次网络赛挺有信心的(去年好像四个题就能进,当然要手速快). 这次网络赛还是有四个水题 ...

  2. 2022-BNUZ-IT节程序设计竞赛网络赛题解

    IT节程序设计竞赛-网络赛题目解析 A-纯阳之体 解析 ​ 本题是一个双指针问题,当然直接暴力也是可以做的.主要思想就是先求最长连续且不含重复字符的字串的长度.有了长度之后就可以再进行一次搜索,当长度 ...

  3. xcpc网络赛个人总结(文笔不好,纯纯记录)

    经过长达三周的鏖战也是结束了xcpc网络赛之旅(是否意味着我没比赛打了),这三场比赛让我有所收获.压力.打击.收获就是让我继续坚持练习思维,加快签到速度才是王道吧,好像铜牌根本不需要很高端的算法??? ...

  4. 2011 ACM/ICPC 福州赛区网络赛解题报告

    第一次写网络赛的题解,福州赛区网络赛作为我第一年ACM最后一次网络赛酱油,画了一个很像逗号的句号.....好吧,还得为北京现场赛准备啊准备....... 这次酱油打的很犀利,貌似出第一题很快,之后节奏 ...

  5. ACM练级日志:HDU 4735(ACM 成都网络赛) 重复覆盖与DLX

    今天费了一下午+一晚上的劲,终于把重复覆盖问题给解决了.作为这算法的牺牲品的就是成都网络赛让我知道DLX这东西存在的那道题,HDU 4735.这也是第一次尝试独立对问题构造矩阵然后调用DLX得出结果的 ...

  6. CCPC 网络赛总结

    下午这场比赛一开始就没有给自己太大的压力,本着把水题全部 AC 的意愿 大学第一次网络赛就这样结束了,一开始跟着榜做,签到题很快就解决了,不过这次的比赛真的是刷新了我对题意的认识,各种数学公式交叉在一 ...

  7. 2018ACM-ICPC徐州赛区网络赛: A. Hard to prepare(递推)

    2018ACM-ICPC徐州赛区网络赛: A. Hard to prepare(递推) After Incident, a feast is usually held in Hakurei Shrin ...

  8. 乌鲁木齐网络赛J题(最小费用最大流模板)

    ACM ICPC 乌鲁木齐网络赛 J. Our Journey of Dalian Ends 2017-09-09 17:24 243人阅读 评论(0) 收藏 举报  分类: 网络流(33)  版权声 ...

  9. 2019 ACM - ICPC 上海网络赛 E. Counting Sequences II (指数型生成函数)

    繁凡出品的全新系列:解题报告系列 -- 超高质量算法题单,配套我写的超高质量题解和代码,题目难度不一定按照题号排序,我会在每道题后面加上题目难度指数(1∼51 \sim 51∼5),以模板题难度 11 ...

  10. ACM网络赛金华赛区的一道关于树的题:Family Name List

    三场网络赛终于告一段落了!唉,实力太弱了!跟北大.清华这些家伙差距太远了,比"我在你身边你却不知道我爱你"的距离还要远! 这道题没有来得及提交,自己下来写完的,把样例过了!留在博客 ...

最新文章

  1. Mac下使用svn命令
  2. 【Linux入门连载三】Linux常用的基本命令
  3. Codeforces 993A. Two Squares(暴力求解)
  4. .NET Framework 4.7正式发布
  5. HDU - 6769-In Search of Gold-二分+树形dp
  6. 工作237:vuex取值
  7. JeecgBoot 连接达梦数据库
  8. android美颜功能吗,Android美颜sdk接入之前需要知道这些知识吗
  9. opensuse安装Tomcat碰到的问题
  10. JAVA Excel com组件_jacob java调用com组件基础运用
  11. 《图论及其应用》学习笔记(匹配和因子分解)
  12. Tcp滑动窗口协议简介
  13. 大学python实训总结-python实训总结
  14. java编程题身高排队,试题 算法训练 预测身高
  15. linux下查找配置文件
  16. R语言使用psych包进行主成分分析PCA和探索性因子分析EFA的常用函数介绍:principal、fa、fa.parallel、factor.plot、fa.diagram、scree
  17. 《从零开始的 RPG 游戏制作教程》第十期:信息反馈(下)
  18. 用Python写个空课表生成器-Excel文件操作实例
  19. 一篇读懂5G:到底什么是5G?为什么需要5G?5G有哪些机遇?
  20. Fiddler中篡改后端返回数据

热门文章

  1. 4.2创建自定义Spring Boot自动配置Starter
  2. 【渝粤教育】国家开放大学2018年春季 7392-21DMatlab语言及其应用 参考试题
  3. [渝粤教育] 重庆工程职业技术学院 Linux服务器配置与管理 参考 资料
  4. OpenAI对强化学习环境的汇总
  5. 手把手教你强化学习(十) 基于Stochastic Policy的深度强化学习方法
  6. MySQL进阶路:从小工到专家的必读书籍和必备工具
  7. 笔试错题--(字符串常量池和JVM运行时数据区)
  8. [转]《帮我买个单》
  9. 【转】每一种创伤,都是一种成熟
  10. java内部类之成员内部类实例