五校联考解题报告
预计分数:100 + 100 + 10 + 100 + 30 + 25 = 365
实际分数:0 + 100 + 10 + 100 + 30 + 25 = 265
Day1T1卡着下标开了一个数组,然后本机无论开不开O2都能A,交上去不开O2也能A
然而这场比赛开O2 %……&*()
心路历程
Day1
上来看T1,不会做。。
看T2,sb题,切掉。
回头看T1,sb题,切掉
此时时间刚过去一个小时
看T3。。。这么鬼畜???完全不会做啊。
10min打完暴力。开始划水。。
划啊划。。划到比赛结束。。。。GG
Day2
上来看T1,sb题,切掉
看T2,不可做。
看T3,这和期望貌似没关系啊。。直接线段树暴力改不就行了么??然后留了1h来搞T3
回去去刚T2,昏天黑地的搞了一波(没错我当时就是这种感觉),本来以为自己的dp是$n^2$,结果发现少转移了一情况就变成了$n^3$,
然而它没给$n^3$的暴力分(差评!),于是就变成了和dfs一样的分
此时已经11:00。T3正解肯定是打不完了。只好写25分暴力。
凉凉。。
T1
看似很麻烦,实际上我们对骰子的各个面重标号一下,就很简单了
/* */ #include<cstdio> #include<cstring> #include<algorithm> #include<map> #include<vector> #include<set> #include<queue> #include<cmath> #define Pair pair<int, int> #define MP(x, y) make_pair(x, y) #define fi first #define se second #define LL long long //#define LL long long //#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++) //char buf[(1 << 22)], *p1 = buf, *p2 = buf; using namespace std; const LL MAXN = 8, INF = 1e9 + 10; const double eps = 1e-9; 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; LL a[6], b[6]; LL get(LL *a, LL opt) {//1右 0左 LL cur = a[1]; LL limit = M - 1; cur += (a[1] + a[2] + a[3] + a[4]) * (limit / 4); for(LL i = 1; i <= limit % 4; i++) { if(opt == 1) { LL tmp = a[1]; a[1] = a[2]; a[2] = a[3]; a[3] = a[4]; a[4] = tmp; } else { LL tmp = a[1]; a[1] = a[4]; a[4] = a[3]; a[3] = a[2]; a[2] = tmp; } cur += a[1]; } return cur; } void rotate(LL *a) { LL tmp = a[5]; a[5] = a[1]; a[1] = a[6]; a[6] = a[3]; a[3] = tmp; } int main() { // freopen("dice.in", "r", stdin); // freopen("dice.out", "w", stdout); N = read(); M = read(); LL ans = 0; a[1] = 1; a[2] = 4; a[3] = 6; a[4] = 3; a[5] = 2; a[6] = 5; for(LL i = 1; i <= N; i++) { ans += get(a, i & 1); rotate(a); } printf("%I64d", ans); return 0; } /* */
T2
直接用树上数组维护。可以先做一遍小于,再把序列翻转过来再做一遍
/* */ #include<cstdio> #include<cstring> #include<algorithm> #include<map> #include<vector> #include<set> #include<queue> #include<cmath> #define Pair pair<int, int> #define MP(x, y) make_pair(x, y) #define fi first #define se second #define LL long long //#define LL long long //#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++) //char buf[(1 << 22)], *p1 = buf, *p2 = buf; using namespace std; const LL MAXN = 8, INF = 1e9 + 10; const double eps = 1e-9; 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; LL a[6], b[6]; LL get(LL *a, LL opt) {//1右 0左 LL cur = a[1]; LL limit = M - 1; cur += (a[1] + a[2] + a[3] + a[4]) * (limit / 4); for(LL i = 1; i <= limit % 4; i++) { if(opt == 1) { LL tmp = a[1]; a[1] = a[2]; a[2] = a[3]; a[3] = a[4]; a[4] = tmp; } else { LL tmp = a[1]; a[1] = a[4]; a[4] = a[3]; a[3] = a[2]; a[2] = tmp; } cur += a[1]; } return cur; } void rotate(LL *a) { LL tmp = a[5]; a[5] = a[1]; a[1] = a[6]; a[6] = a[3]; a[3] = tmp; } int main() { // freopen("dice.in", "r", stdin); // freopen("dice.out", "w", stdout); N = read(); M = read(); LL ans = 0; a[1] = 1; a[2] = 4; a[3] = 6; a[4] = 3; a[5] = 2; a[6] = 5; for(LL i = 1; i <= N; i++) { ans += get(a, i & 1); rotate(a); } printf("%I64d", ans); return 0; } /* */
T3
非常神仙,我还没怎么搞懂。。
大概搞懂了吧,但是实在不想写qwq
大体口胡一下吧
首先增加一个虚点,把问题转化为平面问题
用$f[i]$表示共有$i$列柱子的方案,转移的时候需要考虑是否与第一列相同 / 是否与前一列相同
$f[i][0/1/2][0/1/2]$表示当前填到第 i 列,右上角的点颜色和左上角左下角都不同/和左上角相同/左下角相同,右下角的点颜色和左上角左下角都不同/和左上角相同/左下角相同的方案数
暴力递推即可
然后转成矩阵快速幂就A了。
T4
直接暴力差分维护
我就不信有人代码比我短
#include<cstdio> #include<map> #define mit map<int, int> ::iterator #define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++) char buf[(1 << 22)], *p1 = buf, *p2 = buf; using namespace std; inline int read() { char c = getchar(); int 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; } int N; map<int, int> mp; main() { freopen("meizi.in", "r", stdin); freopen("meizi.out", "w", stdout); N = read(); for(int i = 1; i <= N; i++) { int l = read(), r = read(); mp[l]++; mp[r + 1]--; } int ans = 0, now = 0; for(mit i = mp.begin(); i != mp.end(); i++) now += i -> second, ans = max(ans, now); printf("%d", ans); return 0; } /* */
T5
https://www.cnblogs.com/zwfymqz/p/9537971.html
T6
https://www.cnblogs.com/zwfymqz/p/9538124.html