心路历程

预计得分:\(100 + 100 + 100 = 300\)

实际得分:\(100 +100 +100 = 300\)

学OI两年终于AK了一次qwq(虽然题目炒鸡水。。)

纪念一下这令人激动的时刻。。

8点开始考,9:40就都拍上了。。可见题目确实水。。然后又去做了做另一套

Sol

T1

题目中给的两个数组没啥卵用,都是可以直接求的

然后离散化+树状数组就完了

#include<cstdio>
#include<algorithm>
#include<iostream>
#define lb(x) (x & (-x))
#define LL long long
using namespace std;
const LL MAXN = 1e6 + 10;
inline LL read() {
char c = getchar(); LL x = 0, f = 1;
while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
LL N, f[MAXN], g[MAXN], a[MAXN], mod;
LL add(LL x, LL y) {
if(x + y < 0) return x + y + mod;
return x + y >= mod ? x + y - mod : x + y;
}
LL mul(LL x, LL y) {
return 1ll * x * y % mod;
}
LL fp(LL a, LL p) {
LL base = 1;
while(p) {
if(p & 1) base = mul(base, a);
a = mul(a, a); p >>= 1;
}
return base;
}
LL date[MAXN], num;
void Des() {
sort(date + 1, date + num + 1);
num = unique(date + 1, date + num + 1) - date - 1;
for(LL i = 1; i <= N; i++) f[i] = lower_bound(date + 1, date + num + 1, f[i]) - date,
g[i] = lower_bound(date + 1, date + num + 1, g[i]) - date;
}
LL T[MAXN];
void Add(LL x, LL val) {
while(x <= num) T[x] += val, x += lb(x);
}
LL Query(LL x) {
LL ans = 0;
while(x) ans += T[x], x -= lb(x);
return ans;
}
int main() {
freopen("calc.in", "r", stdin);
freopen("calc.out", "w", stdout);
N = read(); mod = read();
for(LL i = 1; i <= N; i++) a[i] = read(), f[i] = fp(i, a[i]), g[i] = fp(a[i], i),
date[++num] = f[i], date[++num] = g[i];
Des();
LL ans = 0;
for(LL i = N; i >= 1; i--) {
ans += Query(f[i] - 1);
Add(g[i], 1);
}
cout << ans;
return 0;
}

T2

这题比较interesting啊。

我是先做的T3再回来做的T2

首先二分答案

很显然的一个贪心是从左往右扫,如果遇到一个不合法的点\(i\),那么升级\(i + R\)处的炮台。。

和暴力拍了10000多组没错误。。赢了

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
const LL MAXN = 2e6;
inline LL read() {
char c = getchar(); LL x = 0, f = 1;
while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
LL N, R;
LL tag[MAXN], s[MAXN], a[MAXN], b[MAXN], K;
bool check(LL val) {
memset(tag, 0, sizeof(tag));
LL now = 0, res = K, flag = 1;
for(LL i = 1; i <= N; i++) {
now += tag[i];
a[i] += now;
if(a[i] < val) now += val - a[i], tag[i + 2 * R + 1] -= val - a[i], res -= val - a[i];
if(res < 0) {flag = 0; break;}
}
memcpy(a, b, sizeof(a));
return flag;
}
LL Query(LL l, LL r) {
r = min(r, N);
if(l < 0) return s[r];
return s[r] - s[l];
}
int main() {
freopen("game.in", "r", stdin); freopen("game.out", "w", stdout);
N = read(); R = read(); K = read();
for(LL i = 1; i <= N; i++) a[i] = read(), s[i] = s[i - 1] + a[i];
for(LL i = 1; i <= N; i++) a[i] = Query(i - R - 1, i + R);
for(LL i = 1; i <= N; i++) b[i] = a[i];
LL l = 0, r = 3e18, ans = 0;
while(l <= r) {
LL mid = (l + r) >> 1;
if(check(mid)) l = mid + 1, ans = mid;
else r = mid - 1;
}
cout << ans;
return 0;
}

T3

出题人还能再套路一点么。。

首先把询问离线后从小到大排序

合并的时候用带权并查集维护一下

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#define Pair pair<LL, LL>
#define MP make_pair
#define fi first
#define se second
#define LL long long
using namespace std;
const LL MAXN = 1e6 + 10, INF = 1e9 + 10;
inline LL read() {
char c = getchar(); LL x = 0, f = 1;
while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
LL N, M, Q, cnt, fa[MAXN], w[MAXN], ans, out[MAXN];
struct Edge {
LL u, v, w;
bool operator < (const Edge &rhs) const {
return w < rhs.w;
}
}E[MAXN];
Pair q[MAXN];
LL find(LL x) {
return fa[x] == x ? fa[x] : fa[x] = find(fa[x]);
}
void AddEdge(LL i) {
LL x = E[i].u, y = E[i].v, v = E[i].w;
LL fx = find(x), fy = find(y);
if(fx == fy) w[fx] += v, ans = max(ans, w[fx]);
else {
fa[fx] = fy; w[fy] += v + w[fx]; w[fx] = 0;
ans = max(ans, w[fy]);
}
}
int main() {
freopen("graph.in", "r", stdin); freopen("graph.out", "w", stdout);
N = read(); M = read(); Q = read();
for(LL i = 1; i <= N; i++) fa[i] = i;
for(LL i = 1; i <= M; i++) E[i].u = read(), E[i].v = read(), E[i].w = read();
sort(E + 1, E + M + 1);
for(LL i = 1; i <= Q; i++) q[i] = MP(read(), i);
sort(q + 1, q + Q + 1);
LL j = 1;
for(LL i = 1; i <= Q; i++) {
while(j <= M && E[j].w <= q[i].fi)
AddEdge(j++);
out[q[i].se] = ans;
}
for(LL i = 1; i <= Q; i++) printf("%I64d\n", out[i]);
return 0;
}

11.6NOIP模拟赛解题报告的更多相关文章

  1. 11.1NOIP模拟赛解题报告

    心路历程 预计得分:\(100 + 100 + 50\) 实际得分:\(100 + 100 + 50\) 感觉老师找的题有点水呀. 上来看T1,woc?裸的等比数列求和?然而我不会公式呀..感觉要凉 ...

  2. 11.7NOIP模拟赛解题报告

    心路历程 预计得分:\(50 + 100 + 100\) 实际得分:\(50 + 100 +100\) T2 T3两道数据结构题美滋滋,然而写完就过去\(3h\)美滋滋 T1数学题学弟们都会做Orzz ...

  3. 11.5NOIP模拟赛解题报告

    心路历程 预计得分:\(100 + 40 + 30 = 170\) 实际得分:\(100 +100 + 50 = 250\) 辣鸡数据毁我青春 T1一眼不会做感觉要凉 T2好像一波折半搜索就做完了 T ...

  4. 10.30 NFLS-NOIP模拟赛 解题报告

    总结:今天去了NOIP模拟赛,其实是几道USACO的经典的题目,第一题和最后一题都有思路,第二题是我一开始写了个spfa,写了一半中途发现应该是矩阵乘法,然后没做完,然后就没有然后了!第二题的暴力都没 ...

  5. 20201101gryz模拟赛解题报告

    写在前面 2020rp++ 停课的第一场模拟赛 拿上一年的上一年的day1来考的, 结果得分期望220pts,实际135pts,rank3,太菜了 考着考着机房灯突然灭了,当时慌的一批 以为断电代码要 ...

  6. 2018.10.26NOIP模拟赛解题报告

    心路历程 预计得分:\(100 + 100 + 70\) 实际得分:\(40 + 100 + 70\) 妈妈我又挂分了qwq..T1过了大样例就没管,直到临考试结束前\(10min\)才发现大样例是假 ...

  7. 2018.10.17NOIP模拟赛解题报告

    心路历程 预计得分:\(100 + 100 +100\) 实际得分:\(100 + 100 + 60\) 辣鸡模拟赛.. 5min切掉T1,看了一下T2 T3,感觉T3会被艹爆因为太原了.. 淦了20 ...

  8. 2018.10.16 NOIP模拟赛解题报告

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

  9. 20201115gryz模拟赛解题报告

    写在前面 T1:期望100pts,实际0pts(7:50 ~ 8:50 T2:期望0pts,实际0pts(10:00 ~ 10:35 T3:期望20pts,实际40pts( 9:10 ~ 10:00, ...

随机推荐

  1. luogu4074 [WC2013]糖果公园(树上带修莫队)

    link 题目大意:给一个树,树上每个点都有一种颜色,每个颜色都有一个收益 每次修改一个点上的颜色 或询问一条链上所有颜色第i次遇到颜色j可以获得w[i]*v[j]的价值,求链上价值和 题解:树上带修 ...

  2. BZOJ1688 Disease Manangement 疾病管理

    Disease Manangement 疾病管理   Description Alas! A set of D (1 <= D <= 15) diseases (numbered 1..D ...

  3. ssh协议git利用ss代理

    前言 不知道ss为何物的绕道 求帐号的绕道 这里只是亲测 ssh协议下的git, 如何判断是什么协议出门左拐 判断是否需要代理 我遇到的问题是: ssh_exchange_identification ...

  4. tomcat下各个文件夹的作用

    1.bin目录:这个文件夹包含的是启动/关闭tomcat的脚本,里面有startup.sh(Linux环境下启动tomcat脚本)和startup.bat(Windows环境下启动tomcat脚本), ...

  5. next_permutation(全排列)

    废话不多说,直接上代码,谁测试,谁知道 C++: #include<bits/stdc++.h> using namespace std; typedef long long ll; in ...

  6. springcloud(三)-Eureka

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

  7. Oracle WebLogic Server 12c 新特性

    美国时间2011年 12月9日,Oracle公司正式发布WebLogic 12c版本,c是cloud的缩写.截止当前(2013年8月)最新版本为Oracle WebLogic Server 12c ( ...

  8. Ubuntu no such file or directory

    在运行可执行程序时,报错如上,检查步骤: 1.程序是否和Ubuntu版本位数一致. Linux系统查看:uname -a 程序版本查看:file <filename> 2.查看文件是否有可 ...

  9. 安装vs2013要求重启后安装

    解决方案: 卸载360,然后杀毒, 重启电脑就可以直接安装vs了

  10. 新建IP核为灰色并显示there is no project open

    问题: ise显示there is no project open. “You may browse the IP Catalog but you will not be able to genera ...