10.5
可能是因为坚持一早自习没睡觉,考试特别困。然后一点考试的状态都没有。
连基础的状态压缩都搞不到手了,没开longlong,题意读错导致数组问题等出现了很多问题。
没有合理安排时间,写第一题代码我记得是10点。
预计得分:100 + 22 + 0
实际得分:0+2+0
考完心态爆炸了
仅仅只有T1代码剩下两道题没补
#include <bits/stdc++.h>
using namespace std;
#define gc getchar()
#define rep(i , x, y) for(int i = x;i <= y;++ i)
#define sep(i , x, y) for(int i = x;i >= y;-- i)
#define int long long
inline int gi() {
int x = 0,f = 1;char c = gc;
while(c < '0' || c > '9') {if(c == '-')f = -1;c = gc;}
while(c >= '0' && c <= '9') {x = x * 10 + c - '0';c = gc;}
return x * f;
}
const int maxN = 3e3 + 7;
int sum[maxN][maxN];
int t1[maxN][maxN];
int t2[maxN][maxN];
int t3[maxN][maxN],t4[maxN][maxN];
int n , q;
void solve() {
for(int i = 1;i <= n;++ i) {
for(int j = 1;j <= n;++ j) {
sum[i][j] = sum[i][j] + sum[i][j - 1] + t1[i][j] + t4[i][j];
}
}
int ans = 0;
rep(i , 1, n) {
rep(j , 1, n) {
ans ^= sum[i][j];
}
}
cout << ans;
}
void work() {
rep(i , 1, n) {
rep(j , 1, n) {
t1[i][j] = t1[i - 1][j] + t2[i][j];
}
}
rep(i , 1, n) {
rep(j , 1, n) {
t4[i][j] = t4[i - 1][j - 1] + t3[i][j];
}
}
return ;
}
signed main() {
// freopen("u.in","r",stdin);
// freopen("u.out","w",stdout);
n = gi();q = gi();
while(q --) {
int r = gi() , c = gi(),l = gi(),s = gi();
t2[r][c] += s;
t2[r + l][c] -= s;
t3[r][c + 1] -= s;
t3[r + l][c + l + 1] += s;
}
work();
solve();
return 0;
}
10.6
考过的模拟赛,T2是个假题,T3神仙题。
花几分钟写了T1,T3 60,然后就开始看别的课件了。
神仙学弟sjp搜索踩爆状态压缩了,很裸很裸的那种搜索。
牛皮
T2就不补了
T1:
#include <bits/stdc++.h>
using namespace std;
#define gc getchar()
#define rep(i , x, y) for(int i = x;i <= y;++ i)
#define sep(i , x, y) for(int i = x;i >= y;-- i)
inline int gi() {
int x = 0, f = 1;char c = gc;
while(c < '0' || c > '9') {if(c == '-')f = -1;c = gc;}
while(c >= '0' && c <= '9') {x = x * 10 + c - '0';c = gc;}
return x * f;
}
const int maxN = 1e5 + 7;
struct Node {
int l , x, v;
}a[maxN];
int main() {
freopen("cruise.in","r",stdin);
freopen("cruise.out","w",stdout);
int T = gi();
while(T --) {
int n = gi();
rep(i , 1, n + 1) a[i].l = gi();
rep(i , 1, n + 1) a[i].x = gi();
rep(i , 1, n + 1) a[i].v = gi();
// double t = 1.0 * (a[n + 1].x + a[n + 1].l) / a[n + 1].v;
// for(int i = n;i >= 2;-- i) {
// int L = a[i].v * t;
// if(L >= a[i].x) {
// t += 1.0 * a[i].l / a[i].v;
// }else {
// t = 1.0 * (a[i].x + a[i].l) / a[i].v;
// }
// }
printf("%lf\n",t);
// int L = a[1].v * t;
// if(L + a[1].l <= a[1].x) {
// t += 1.0 * a[1].l / a[1].v;
// }else {
// t = 1.0 * a[1].x / a[1].v;
// }
// printf("%lf",t);
double ans = 0;
double sum = 0;
for(int i = 1;i <= n + 1;i++) {
if(i != 1) sum += a[i].l;
double t = (a[i].x + sum) / a[i].v;
ans = max(t,ans);
}
printf("%.10f\n",ans);
}
return 0;
}
T3:
#include <bits/stdc++.h>
using namespace std;
#define rep(i , x, y) for(int i = x;i <= y;++ i)
#define sep(i , x, y) for(int i = x;i >= y;-- i)
const int maxN = 10 + 7;
char a[maxN][maxN];
int f[maxN][maxN][maxN][maxN];
int calc(int x1, int y1, int x2, int y2, int i1, int j1, int i2, int j2) {
int res = 0;
for (int i = i1; i <= i2; ++ i)
for (int j = j1; j <= j2; ++ j)
if (a[i][j] == '#')
res += max(max(abs(i-x1), abs(i-x2)), max(abs(j-y1), abs(j-y2)));
return res;
}
int dp(int x1 , int y1, int x2 , int y2) {
if(x1 > x2 || y1 > y2) return 0;
int &res = f[x1][y1][x2][y2];
if(res > -1) return res;
res = calc(x1, y1, x2, y2, x1, y1, x1, y2) + dp(x1+1, y1, x2, y2);
res = min(res, calc(x1, y1, x2, y2, x2, y1, x2, y2) + dp(x1, y1, x2-1, y2));
res = min(res, calc(x1, y1, x2, y2, x1, y1, x2, y1) + dp(x1, y1+1, x2, y2));
res = min(res, calc(x1, y1, x2, y2, x1, y2, x2, y2) + dp(x1, y1, x2, y2-1));
return res;
}
int main() {
memset(f , -1, sizeof(f));
rep(i , 1, 8) scanf("%s",a[i] + 1);
printf("%d",dp(1,1,8,8));
return 0;
}