没话说了,S组没进复赛,只能打J组,J组打的也是一团糟。。
上午8:10
进考场了,打开vscode写模板
上午8:25
密码发下来了,开始解压,喝口水压压惊.
开始浏览题目,看到T3我又惊了(又是一元二次方程,CCF这么喜欢一元二次吗?)。
上午8:30
开始比赛了。
T1一眼思维题,便开始推导思路。
上午9:20
T1找规律找不下去了,就本着正解和暴力只差10pts的原则,打了暴力,骗了90pts。
赛时T1代码
赛时的代码就是暴力,暴力,暴力,当时没有想到正解。。。
#include
using namespace std;
long long n, l, f[10000005], cnt, a[10000005], k;
int main() {
freopen("apple.in", "r", stdin);
freopen("apple.out", "w", stdout);
cin >> n;
for (k = 1;; k++) {
l++, cnt = 0;
bool flag = false;
for (int i = 1; i <= n; i++) {
if (f[i] == 0) {
flag = true;
break;
}
}
if (flag == false) {
break;
}
for (int i = 1; i <= n; i++) {
if (f[i] != 1) {
++cnt;
if (cnt % 3 == 1) {
a[i] = l;
f[i] = 1;
}
}
}
}
cout << k - 1 << " " << a[n] << "\n";
return 0;
}
发现时间不多了,立马开始看T2,一眼贪心。
上午9:30
T2知道了怎么做,就是找下降子序列。
上午9:50
T2打完了,当时脑子抽了,打了前缀和+离散化+贪心,大样例过了,便心安了。
T2赛时代码
wssb,打了一大堆东西,后来缩减一下就A了!
#include
using namespace std;
long long n, d, v[100005], t[100005];
long long pre, q[100005], ans, dis;
double oil;
struct node {
long long id, val;
friend bool operator<(node x, node y) {
return x.val < y.val;
}
} a[100005];
int main() {
freopen("road.in", "r", stdin);
freopen("road.out", "w", stdout);
cin >> n >> d;
for (int i = 1; i < n; i++) {
cin >> v[i];
}
for (int i = 1; i <= n; i++) {
cin >> a[i].val;
q[i + 1] = q[i] + v[i];
t[i] = a[i].val;
}
sort(t + 1, t + n + 1);
for (int i = 1; i <= n; i++) {
long long j = lower_bound(t + 1, t + n + 1, a[i].val) - t;
a[i].id = j;
}
for (int i = 1; i <= n;) {
oil -= dis * 1.0 / d;
for (int j = i + 1; j <= n; j++) {
if (j == n) {
dis = q[j] - q[i];
ans += ((long long)ceil(dis * 1.0 / d - oil)) * a[i].val;
cout << ans;
return 0;
}
if (a[j].id < a[i].id) {
dis = q[j] - q[i];
ans += ((long long)ceil(dis * 1.0 / d - oil)) * a[i].val;
oil += ceil(dis * 1.0 / d);
i = j, pre = i;
break;
}
}
}
return 0;
}
开始看T3,一眼大模拟。
上午10:30
大模拟打完了,大样例没过,开始调试。但不知道为什么考场的那个vscode调试不了,于是就只能手动输出过程。
上午11:50
调试了半天,大样例终于过了,Ctrl+S保存了代码。
T3赛时代码
有点多,大模拟
#include
using namespace std;
int n, up, a, b, c;
int main() {
freopen("uqe.in", "r", stdin);
freopen("uqe.out", "w", stdout);
cin >> n >> up;
for (int t = 1; t <= n; t++) {
cin >> a >> b >> c;
int derta = b * b - 4 * a * c;
if (derta < 0) {
cout << "NO\n";
} else {
int tmpb = -b, tmpm = 2 * a;
if (b == 0) {
if (tmpm > 0) {
int d = tmpm * tmpm;
if (derta == d) {
cout << 1 << "\n";
} else {
int s = derta / __gcd(derta, d);
int m = d / __gcd(derta, d);
int mod = 1;
for (int j = sqrt(s * m); j >= 2; j--) {
if ((s * m) % (j * j) == 0) {
mod = j;
break;
}
}
cout << mod << "\n";
if (mod == 1) {
cout << "sqrt(" << s*m << ")";
if (m != 1) {
cout << "/" << m;
}
cout << "\n";
} else {
cout << mod << "*sqrt(" << s*m / mod / mod << ")";
if (m != 1) {
cout << "/" << m;
}
cout << "\n";
}
}
} else {
int d = tmpm * tmpm;
if (derta == d) {
cout << 1 << "\n";
} else {
int s = derta / __gcd(derta, d);
int m = c / __gcd(derta, d);
cout << "-sqrt(" << s*m << ")/" << m << "\n";
}
}
continue;
} else {
if (sqrt(derta)*sqrt(derta) == derta) {
int son = tmpb + sqrt(derta);
if (son == 0) {
cout << 0;
} else if (son > 0 && tmpm > 0 || son < 0 && tmpm < 0) {
int son2 = abs(tmpb - sqrt(derta));
if (son < 0) {
son2 = abs(son2);
tmpm = abs(tmpm);
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
if (son2 % tmpm == 0) {
cout << son2 / tmpm << "\n";
} else {
cout << son2 / __gcd(son2, tmpm) << "/" << tmpm / __gcd(son2, tmpm) << "\n";
}
} else {
son = abs(son);
tmpm = abs(tmpm);
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
if (son % tmpm == 0) {
cout << son / tmpm << "\n";
} else {
cout << son / __gcd(son, tmpm) << "/" << tmpm / __gcd(son, tmpm) << "\n";
}
}
} else {
int son2 = tmpb - sqrt(derta);
if (son2 > 0 && tmpm > 0 || son2 < 0 && tmpm < 0) {
son2 = abs(son2);
tmpm = abs(tmpm);
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
if (son2 % tmpm == 0) {
cout << son2 / tmpm << "\n";
} else {
cout << son2 / __gcd(son2, tmpm) << "/" << tmpm / __gcd(son2, tmpm) << "\n";
}
} else {
son = abs(son);
son2 = abs(son2);
tmpm = abs(tmpm);
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
if (son2 * 1.0 / tmpm > son * 1.0 / tmpm) {
if (son2 % tmpm == 0) {
cout << "-" << son2 / tmpm << "\n";
} else {
cout << "-" << son2 / __gcd(son2, tmpm) << "/" << tmpm / __gcd(son2, tmpm) << "\n";
}
} else {
if (son % tmpm == 0) {
cout << "-" << son / tmpm << "\n";
} else {
cout << "-" << son / __gcd(son, tmpm) << "/" << tmpm / __gcd(son, tmpm) << "\n";
}
}
}
}
continue;
} else {
if (tmpm < 0) {
if (tmpb < 0) {
if (abs(tmpb) % abs(tmpm) != 0) {
int g = __gcd(abs(tmpb), abs(tmpm));
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
cout << abs(tmpb) / g << "/" << abs(tmpm) / g << "+sqrt(" << derta << ")/" << abs(tmpm) << "\n";
} else {
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
cout << abs(tmpb) / abs(tmpm) << "+sqrt(" << derta << ")/" << abs(tmpm) << "\n";
}
continue;
} else {
if (abs(tmpb) % abs(tmpm) != 0) {
int g = __gcd(abs(tmpb), abs(tmpm)), mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
if (mod % abs(tmpm) == 0) {
cout << "-" << abs(tmpb) / g << "/" << abs(tmpm) / g << "+sqrt(" << derta / mod / mod << ")/" << mod / abs(tmpm) << "\n";
} else {
if (mod != 1) {
cout << "-" << abs(tmpb) / g << "/" << abs(tmpm) / g << "+" << mod << "*sqrt(" << derta / mod / mod << ")/" << abs(tmpm) << "\n";
}
cout << "-" << abs(tmpb) / g << "/" << abs(tmpm) / g << "sqrt(" << derta / mod / mod << ")/" << abs(tmpm) << "\n";
}
} else {
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
cout << "-" << abs(tmpb) / abs(tmpm) << "+sqrt(" << derta << ")/" << abs(tmpm) << "\n";
}
continue;
}
} else {
if (tmpb < 0) {
if (abs(tmpb) % abs(tmpm) != 0) {
int g = __gcd(abs(tmpb), abs(tmpm));
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
cout << "-" << abs(tmpb) / g << "/" << abs(tmpm) / g << "+sqrt(" << derta << ")/" << abs(tmpm) << "\n";
} else {
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
cout << "-" << abs(tmpb) / abs(tmpm) << "+sqrt(" << derta << ")/" << abs(tmpm) << "\n";
}
continue;
} else {
if (abs(tmpb) % abs(tmpm) != 0) {
int g = __gcd(abs(tmpb), abs(tmpm));
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
cout << abs(tmpb) / g << "/" << abs(tmpm) / g << "+sqrt(" << derta << ")/" << abs(tmpm) << "\n";
} else {
int mod = 1;
for (int j = sqrt(derta); j >= 2; j--) {
if (derta % (j * j) == 0) {
mod = j;
break;
}
}
cout << abs(tmpb) / abs(tmpm) << "+sqrt(" << derta << ")/" << abs(tmpm) << "\n";
}
continue;
}
}
}
}
}
}
return 0;
}
开始看T4,虽然只有10min了,但是发现T4输出-1有分,于是就花1min打了一个-1。
中午12:00
考试结束了,如释重负,走出考场闻闻新鲜空气。
晚上8:30
满怀激动的来洛谷测,以为这次300+pts胜券在握。
晚上8:35
T1->90pts理所应当
T2->45pts 大样例都过了,不知道这次是不是有个地方考虑漏了,希望CCF的数据和大样例一样水。。。
T3->0pts 震惊到我了,好说歹说也应该至少50pts啊,我仔细检查了一下自己的代码,调试过程没删!!!我当场晕了过去。。
T4->0pts 理所应当
洛谷上测出来145pts,跟估分差了十万八千里。
估分:90+100+100+[10,20]=[300,310]pts
实际:90+45+0+10=145pts
T3报灵了,全部都因为没有删去调试的中间过程,艹。
没什么好说,这次寄了,如果到明年都不会away from OI,希望明年不要犯如此低级的错误。。。