*注意:这套题目应版权方要求,不得公示题面。

  表示十分怀疑出题人水平,C题数据和标程都是错的。有原题,差评。

Problem A XOR

题目大意

  最小异或生成树

  出门左拐Codeforces 888G。

Code

 #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#ifndef WIN32
#define Auto "%lld"
#else
#define Auto "%I64d"
#endif
using namespace std;
typedef bool boolean;
#define ll long long const int Mask = << ;
const signed int inf = (signed) (~0u >> ); typedef class TrieNode {
public:
TrieNode* ch[];
}TrieNode; TrieNode pool[];
TrieNode* top; TrieNode* newnode() {
top->ch[] = top->ch[] = NULL;
return top++;
} typedef class Trie {
public:
TrieNode* rt; void reset() {
top = pool;
rt = newnode();
} void insert(int x) {
TrieNode* p = rt;
int mask = Mask;
while (mask) {
int c = ((x & mask) ? () : ());
if (!p->ch[c])
p->ch[c] = newnode();
p = p->ch[c], mask >>= ;
}
} int query(int x) {
TrieNode* p = rt;
int mask = Mask, rt = ;
while (mask) {
int c = ((x & mask) ? () : ());
if (p->ch[c])
p = p->ch[c];
else
p = p->ch[c ^ ], rt += mask;
mask >>= ;
}
return rt;
}
}Trie; int n;
int* ar;
Trie tr; inline void init() {
scanf("%d", &n);
ar = new int[(n + )];
for (int i = ; i <= n; i++)
scanf("%d", ar + i);
} ll dividing(int tem, vector<int>& vs) {
if (!tem)
return ;
vector<int> v0, v1;
for (int i = ; i < (signed) vs.size(); i++)
if (vs[i] & tem)
v1.push_back(vs[i]);
else
v0.push_back(vs[i]);
if (!v0.size())
return dividing(tem >> , v1);
if (!v1.size())
return dividing(tem >> , v0);
tr.reset();
for (int i = ; i < (signed) v0.size(); i++)
tr.insert(v0[i]);
int rt = inf;
for (int i = , cmp; i < (signed) v1.size(); i++) {
cmp = tr.query(v1[i]);
rt = min(cmp, rt);
}
return rt * 1ll + dividing(tem >> , v0) + dividing(tem >> , v1);
} inline void solve() {
vector<int> vs;
for (int i = ; i <= n; i++)
vs.push_back(ar[i]);
printf(Auto, dividing(Mask, vs));
} int main() {
freopen("A.in", "r", stdin);
freopen("A.out", "w", stdout);
init();
solve();
return ;
}

Problem A

Problem B GCD

题目大意

  最小gcd生成树,点权1~n。

  加速Kruskal的过程。边排序的时候把编号也作为关键字。

Code

 #include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
typedef bool boolean; int n; inline void init() {
scanf("%d", &n);
} int *uf; int find(int x) {
return (uf[x] == x) ? (x) : (uf[x] = find(uf[x]));
} long long res = ;
inline void solve() {
uf = new int[(n + )];
for (int i = ; i <= n; i++)
uf[i] = i;
for (int i = n >> ; i; i--) {
for (int j = i << ; j <= n; j += i) {
if (find(i) != find(j)) {
res += i;
uf[find(i)] = find(j);
}
}
}
cout << res << endl;
} int main() {
freopen("B.in", "r", stdin);
freopen("B.out", "w", stdout);
init();
solve();
return ;
}

Problem B

Problem C SEG

题目大意

  平面的三角剖分。问边数的奇偶性。

  mmp,最开始理解错题意了。是说咋觉得不可做。

  可以求出凸包,设凸包上的点数和边数均为$m$。然后设顶点总数为$V$,边数为$E$,分割成的三角形的个数为$x$。

  则根据欧拉公式有:$x + 1 + V - \frac{3x + m}{2} = 2$

  解得:$x = 2n - m - 2$,由此得到边数。

  另外这道题数据似乎对极角序不是很友好。

Code

 #include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#ifndef WIN32
#define Auto "%lld"
#else
#define Auto "%I64d"
#endif
using namespace std;
typedef bool boolean; #define ll long long typedef class Point {
public:
ll x, y; Point(ll x = 0.0, ll y = 0.0):x(x), y(y) { } boolean operator < (Point b) const {
if (x ^ b.x)
return x < b.x;
return y < b.y;
}
}Point, Vector; Point operator - (Point a, Point b) {
return Point(a.x - b.x, a.y - b.y);
} ll cross(Point a, Point b) {
return a.x * b.y - a.y * b.x;
} int n, m;
Point* ps; inline void init() {
scanf("%d", &n);
ps = new Point[(n + )];
for (int i = ; i <= n; i++)
scanf(Auto""Auto, &ps[i].x, &ps[i].y);
} int st;
Point* tp; inline void solve() {
tp = new Point[(n + )];
sort(ps + , ps + n + );
for (int i = ; i <= n; i++) {
while (st > && cross(tp[st] - tp[st - ], ps[i] - tp[st]) <= )
st--;
tp[++st] = ps[i];
}
m += st - , st = ;
for (int i = n; i; i--) {
while (st > && cross(tp[st] - tp[st - ], ps[i] - tp[st]) <= )
st--;
tp[++st] = ps[i];
}
m += st; int A = ((n << ) - m) - ;
int E = ( * A + m) >> ;
if (E & )
puts("Alice");
else
puts("Bob");
} int main() {
init();
solve();
return ;
}

Problem C

2018.9.25 NOIP模拟赛的更多相关文章

  1. 2018.9.22 NOIP模拟赛

    *注意:这套题目应版权方要求,不得公示题面. 从这里开始 Problem A 妹子 Problem B 旅程 Problem C 老大 因为业务水平下滑太严重,去和高一考NOIP模拟,sad... P ...

  2. 2018.10.16 NOIP模拟赛解题报告

    心路历程 预计得分:\(100 + 100 + 20 = 220\) 实际得分:\(100 + 100 + 30 = 230\) 辣鸡模拟赛.. T1T2都是一眼题,T3考验卡常数还只有一档暴力分. ...

  3. EZ 2018 07 06 NOIP模拟赛

    又是慈溪那边给的题目,这次终于没有像上次那样尴尬了, T1拿到了较高的暴力分,T2没写炸,然后T3写了一个优雅的暴力就203pts,Rank3了. 听说其它学校的分数普遍100+,那我们学校还不是强到 ...

  4. 2018.02.12 noip模拟赛T2

    二兵的赌注 Description游戏中,二兵要进入了一家奇怪的赌场.赌场中有n个庄家,每个庄家都可以猜大猜小,猜一次一元钱.每一次开彩前,你都可以到任意个庄家那里下赌注.如果开彩结果是大,你就可以得 ...

  5. 2017 10.25 NOIP模拟赛

    期望得分:100+40+100=240 实际得分:50+40+20=110 T1 start取了min没有用,w(゚Д゚)w    O(≧口≦)O T3 代码3个bug :数组开小了,一个细节没注意, ...

  6. 2018/3/20 noip模拟赛 5分

    T1 傻逼题,写了cmp没sort,5分. T2 树上差分,写了树剖线段树,超时,0分. T3 树归,0分. 我是个zz

  7. 2018/3/18 noip模拟赛 20分

    T1 dp,特别裸特别简单,我放弃了写了个dfs. T2 树归,特别裸特别简单,我不会写. T3 贪心二分不知道什么玩意儿反正不会写就对了. 我是个智障

  8. 2018.10.03 NOIP+ 模拟赛 解题报告

    得分: \(30+5+0=35\)(考得真不咋滴) \(T1\):奥义商店(点此看题面) 以为很简单,对着这题想了一个多小时,最后果断打了个暴力交了... ... 看完题解发现其实也不是很难. 对于\ ...

  9. 2018.10.30 NOIp模拟赛T2 数字对

    [题目描述] 小 H 是个善于思考的学生,现在她又在思考一个有关序列的问题.        她的面前浮现出一个长度为 n 的序列{ai},她想找出一段区间[L, R](1 <= L <= ...

随机推荐

  1. nw.js---开发一个百度浏览器

    使用nw.js开发一个简单的百度浏览器就很简单了,只需要在配置里面写入: { // "main": "index.html", "main" ...

  2. E - Heavy Transportation

    来源poj1797 Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now ...

  3. CareerCup All in One 题目汇总

    Chapter 1. Arrays and Strings 1.1 Unique Characters of a String 1.2 Reverse String 1.3 Permutation S ...

  4. react使用BrowserRouter打包后,刷新页面出现404

    文档 https://gkedge.gitbooks.io/react-router-in-the-real/content/apache.html nginx nginx.conf server { ...

  5. @staticmethod和classmethod

    之前一直搞不清楚这两个类方法有什么区别,今天着重学习了一下 @staticmethod是静态方法,不需要表示自身对象的self和自身类的cls参数,就跟使用函数一样. class C(object): ...

  6. switch(值){ 开始case 值: 闭合break; }

    switch ($goods['leixing']) { case 1: $data['type'] = 1; $data['orderid'] = 'PT' . rand(000000, 99999 ...

  7. 解决 .net core 中 nuget 包版本冲突问题

    今天在一个 asp.net core 项目中遇到了 nuget 包版本冲突的问题,错误信息如下: Version conflict detected for Microsoft.AspNet.WebA ...

  8. Python idle运行代码出现'ascii' codec can't encode characters in position 0-2

    编码问题,采用一种方法: Python代码 ,开头加: import sys reload(sys) sys.setdefaultencoding('utf8') 在idle中运行后没错误,但是不显示 ...

  9. RTOS 和中断之间要注意的

    #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY   15 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRI ...

  10. npm笔记

    #执行npm start时是运行的哪个js文件? 打开package.json看看scripts属性中start配置的是什么运行脚本,这里配置的就是你执行npm start时跑的脚本 #设置npm的源 ...