[考试总结]noip模拟17
爆零了!
菜爆了
弱展了
垃爆了
没有什么可以掩饰你的菜了
这次考试为我带来了第一个 \(\color{red}{ \huge{0}}\) 分,十分欣慰。。。。
最近的暴力都打不对,你还想什么正解???
考完之前就差不多知道自己大概是一个零分,然而抱着侥幸打开赛时排行榜的时候,直接翻到最下方就直接看到了自己的名字。。。。
无 \(fa\) 可说。。
自己看题都看不全,谁告诉过你 题目背景 就一定没有用了???
然而 \(sb\;XIN\) 直接跳过,并且默认无向图。。。
\(\huge{\text{你不爆零谁爆零?}}\)
T2 贪心都打不对,真垃。
\(\huge{\text{你不爆零谁爆零?}}\)
T3 打的都不配叫做爆搜。
\(\huge{\text{你不爆零谁爆零?}}\)
菜就是了。。。
世界线:
\(bitset\) + \(toposort\)。
就这?
就这。。
\(bitset\) 常数极小,其实平常的 \(bool\) 数组都可以换成 \(bitset\)。
然后 \(toposort\) 就很普通
#include<bits/stdc++.h>
using std::cout; using std::endl;
#define debug cout<<"debug"<<endl
#define int long long
namespace xin_io
{
#define gc() p1 == p2 and (p2 = (p1 = buf) + fread(buf,1,1<<20,stdin),p1 == p2) ? EOF : *p1++
#define scanf eat1 = scanf
#define freopen eat2 = freopen
int eat1; FILE *eat2; char buf[1<<20],*p1 = buf,*p2 = buf;
inline void openfile() {freopen("t.txt","r",stdin);} inline void outfile() {freopen("o.txt","w",stdout);}
template<class type>inline type get()
{
type s = 0,f = 1; register char ch = gc();
while(!isdigit(ch)) {if(ch == '-') f = -1; ch = gc();}
while(isdigit(ch)) {s = s * 10 + ch - '0'; ch = gc();}
return s * f;
}
}
using namespace xin_io; static const int maxn = 6e4+50,maxm = 1e6+10,inf = 0x7f7f7f,mod = (1<<30);
#define try(i,a,b) for(register signed i=a;i<=b;++i)
#define throw(i,a,b) for(register signed i=a;i>=b;--i)
typedef long long ll;
namespace xin
{
int l,r,an[maxn];
class xin_edge{public:int next,ver;}edge[maxm];
int head[maxn],zhi = 0;
inline void add(int x,int y) {edge[++zhi].ver = y;edge[zhi].next = head[x]; head[x] = zhi;}
int n,m;
int ou[maxn];
int outd[maxn],num[maxn];
bool vis[maxn];
int ret = 0;
std::bitset<(maxn/20)>lian[maxn];
int ans = 0,ind[maxn];
inline void topo()
{
std::queue<int>q;
try(i,1,n) if(!outd[i]) q.push(i);//,cout<<"i = "<<i<<endl;;
while(!q.empty())
{
register int x = q.front(); q.pop();
if(x>=l and x<=r)lian[x][(x-l)] = 1;
for(register int i=head[x];i;i=edge[i].next)
{
register int y = edge[i].ver;
if(x>=l and x<=r)lian[x][(x-l)] = 1;
lian[y] |= lian[x];
if(y>=l and y<=r)lian[y][(y-l)] = 1;
outd[y]--;
if(!outd[y]) q.push(y);
}
}
try(i,1,n)an[i] += lian[i].count();
}
inline short main()
{
#ifndef ONLINE_JUDGE
openfile();
#endif
n = get<signed>(); m = get<signed>();
try(i,1,m)
{
register int x = get<signed>(),y = get<signed>();
add(y,x);ou[x]++; outd[x]++; ind[y]++;
}
l=1;r=std::min(3000ll,n);
while(l<=n)
{
try(i,1,n) lian[i] = 0;
topo();
try(i,1,n)outd[i]=ou[i];
l=r+1,r=std::min(l+3000ll-1,n);
}
try(i,1,n)
ans += an[i] - ind[i];
cout<<ans - n<<endl;
return 0;
}
}
signed main() {return xin::main();}
时间机器:
一个大贪心。
然而你却看不出来。
一个 \(\mathcal O(n^2)\) 暴力狂扫直接 \(70pts\)
然后进一步 \(map\) 优化直接 \(100pts\)
真垃。
#include<bits/stdc++.h>
using std::cout; using std::endl;
#define debug cout<<"debug"<<endl
#define int long long
namespace xin_io
{
#define gc() p1 == p2 and (p2 = (p1 = buf) + fread(buf,1,1<<20,stdin),p1 == p2) ? EOF : *p1++
#define scanf eat1 = scanf
#define freopen eat2 = freopen
int eat1; FILE *eat2; char buf[1<<20],*p1 = buf,*p2 = buf;
inline void openfile() {freopen("t.txt","r",stdin);} inline void outfile() {freopen("o.txt","w",stdout);}
template<class type>inline type get()
{
type s = 0,f = 1; register char ch = gc();
while(!isdigit(ch)) {if(ch == '-') f = -1; ch = gc();}
while(isdigit(ch)) {s = s * 10 + ch - '0'; ch = gc();}
return s * f;
}
}
using namespace xin_io; static const int maxn = 1e6+10,maxq = 3e5+10,inf = 0x7f7f7f7f;
#define try(i,a,b) for(register signed i=a;i<=b;++i)
#define throw(i,a,b) for(register signed i=a;i>=b;--i)
typedef long long ll;
namespace xin
{
int T,n,m;
class node
{
public:
ll l,r,cnt,op;
friend bool operator < (const node &a,const node &b)
{return (a.l==b.l)?a.op<b.op:a.l<b.l;}
}t[maxn];
std::map<ll,ll> mp;
std::map<ll,ll>::iterator it;
inline short main()
{
T = get<signed>();
while(T--)
{
n = get<signed>();m = get<signed>();
mp.clear();
ll cnt=0;
try(i,1,n) t[++cnt].l=get<signed>(),t[cnt].r=get<signed>(),t[cnt].cnt=get<signed>(),t[cnt].op=1;
try(i,1,m) t[++cnt].l=get<signed>(),t[cnt].r=get<signed>(),t[cnt].cnt=get<signed>(),t[cnt].op=-1;
int ok=1;
std::sort(t+1,t+1+cnt);
try(i,1,cnt)
{
//printf("t.op=%lld\n",t[i].op);
if(t[i].op==-1)
mp[t[i].r]+=t[i].cnt;
else
{
while(t[i].cnt)
{
it=mp.lower_bound(t[i].r);
// printf("mp[%lld]=%lld\n",t[i].r,mp[t[i].r]);
if(it==mp.end()) {ok = 0;break; }
if(t[i].cnt >= it->second) t[i].cnt -= it->second,mp.erase(it);
else it->second-=t[i].cnt,t[i].cnt = 0;
}
if(!ok)break;
}
}
!ok ? printf("No\n") : printf("Yes\n");
}
return 0;
}
}
signed main() {return xin::main();}
weight:
首先最小生成树那就先求出来一个。
然后 \(tarjan\) 判断割边就有很多分数。
然后树剖线段树维护就可以 \(\mathcal O(nlogn^2)\)
然而调不出来
[考试总结]noip模拟17的更多相关文章
- 6.17考试总结(NOIP模拟8)[星际旅行·砍树·超级树·求和]
6.17考试总结(NOIP模拟8) 背景 考得不咋样,有一个非常遗憾的地方:最后一题少取膜了,\(100pts->40pts\),改了这么多年的错还是头一回看见以下的情景... T1星际旅行 前 ...
- NOIP模拟17.9.21
NOIP模拟17.9.21 3 58 145 201 161.5 样例输出21.6 数据规模及约定对于40% 的数据,N <= 20对于60% 的数据,N <= 1000对于100% 的数 ...
- NOIP模拟17.9.22
NOIP模拟17.9.22 前进![问题描述]数轴的原点上有一只青蛙.青蛙要跳到数轴上≥
- NOIP模拟 17.8.20
NOIP模拟17.8.20 A.阶乘[题目描述]亲爱的xyx同学正在研究数学与阶乘的关系,但是他喜欢颓废,于是他就制作了一个和阶乘有关系的数学游戏:给出两个整数 n,m,令 t = !n,每轮游戏的流 ...
- NOIP模拟 17.8.18
NOIP模拟17.8.18 A.小菜一碟的背包[题目描述]Blice和阿强巴是好朋友但萌萌哒Blice不擅长数学,所以阿强巴给了她一些奶牛做练习阿强巴有 n头奶牛,每头奶牛每天可以产一定量的奶,同时也 ...
- NOIP模拟 17.8.15
NOIP模拟17.8.15 A 债务文件名 输入文件 输出文件 时间限制 空间限制debt.pas/c/cpp debt.in debt.out 1s 128MB[题目描述]小 G 有一群好朋友,他们 ...
- NOIP模拟 17.8.17
NOIP模拟17.8.17 A 小 G 的字符串文件名 输入文件 输出文件 时间限制 空间限制str.pas/c/cpp str.in str.out 1s 128MB[题目描述]有一天,小 L 给小 ...
- NOIP模拟 17.8.16
NOIP模拟17.8.16 A 债务文件名 输入文件 输出文件 时间限制 空间限制debt.pas/c/cpp debt.in debt.out 1s 128MB[题目描述]小 G 有一群好朋友,他们 ...
- NOIP模拟 17.8.14
NOIP模拟17.8.14 (天宇哥哥考察细心程度的题) [样例解释]如果删去第一个 1:在[3,1,2]中有 3 个不同的数如果删去 3:在[1,1,2]中有 2 个不同的数如果删去第二个 1:在[ ...
随机推荐
- 【NX二次开发】Block UI 树列表
属性说明 属性 类型 描述 常规 BlockID String 控件ID Enable Logical 是否可操作 Group ...
- 1.5w字 + 24张图肝翻 TCP。
TCP 是一种面向连接的单播协议,在 TCP 中,并不存在多播.广播的这种行为,因为 TCP 报文段中能明确发送方和接受方的 IP 地址. 在发送数据前,相互通信的双方(即发送方和接受方)需要建立一条 ...
- 【复习】Listening and Reading Comprehension
短对话 M: Why do you declare the news that you're pregnant on your blog directly? W: I'm so excited tha ...
- OSPF多区域原理与配置
OSPF多区域原理与配置 目录 一.OSPF多区域生成 1.1.生成OSPF多区域的原因 二.OSPF的三种通信量 2.1.域内通信量 2.2.域间通信量 2.3.外部通信量 三.OSPF的路由器类型 ...
- 非静态的字段、方法或属性“System.Web.UI.Page.ClientScript.get”要求对象引用
解决Response.Write("<script>alert('修改失败,请稍后再试!');</script>");布局错误的问题 在后台CS代码(不是C ...
- 1.3.6、通过Path匹配
server: port: 8080 spring: application: name: gateway cloud: gateway: routes: - id: guo-system4 uri: ...
- rename 批量修改文件名
1.rename的用法 rename与mv的区别就是mv只能对单个文件重命名,而rename可以批量修改文件名 linux中的rename有两种版本,一种是C语言版的,一种是Perl版的.早期的Lin ...
- XCTF_Android 黑客精神
一.概述 这题感觉要懂一些开发的东西才能弄,正向和逆向是永远离不开的 二.先用jeb打开,找到AndroidMainfest这个文件,找到启动的主活动是啥 虽然一般也是就是MainActiivity, ...
- 你会用哪些JavaScript循环遍历
总结JavaScript中的循环遍历定义一个数组和对象 const arr = ['a', 'b', 'c', 'd', 'e', 'f']; const obj = { a: 1, b: 2, c: ...
- 根据使用者反馈,对开源项目 go-gin-api 新增两个功能
目录 前言 接口返回的错误信息支持中英文 代码位置 使用方式 错误信息自定义 参数验证的错误信息支持中英文 代码位置 使用方式 错误信息语言包 示例 小结 推荐阅读 前言 根据使用者的反馈,对开源项目 ...