QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#824913 | #9774. Same Sum | ucup-team5319# | WA | 372ms | 50036kb | C++14 | 3.6kb | 2024-12-21 16:29:44 | 2024-12-21 16:29:45 |
Judging History
你现在查看的是最新测评结果
- [2025-01-11 11:59:18]
- hack成功,自动添加数据
- (/hack/1443)
- [2024-12-23 17:02:06]
- hack成功,自动添加数据
- (/hack/1310)
- [2024-12-23 16:48:26]
- hack成功,自动添加数据
- (/hack/1309)
- [2024-12-23 16:33:45]
- hack成功,自动添加数据
- (/hack/1308)
- [2024-12-23 16:23:53]
- hack成功,自动添加数据
- (/hack/1307)
- [2024-12-23 16:13:08]
- hack成功,自动添加数据
- (/hack/1306)
- [2024-12-23 15:54:42]
- hack成功,自动添加数据
- (/hack/1305)
- [2024-12-23 14:58:39]
- hack成功,自动添加数据
- (/hack/1304)
- [2024-12-23 09:58:11]
- hack成功,自动添加数据
- (/hack/1302)
- [2024-12-23 09:47:22]
- hack成功,自动添加数据
- (/hack/1301)
- [2024-12-23 09:41:23]
- hack成功,自动添加数据
- (/hack/1300)
- [2024-12-23 09:26:32]
- hack成功,自动添加数据
- (/hack/1299)
- [2024-12-23 09:19:58]
- hack成功,自动添加数据
- (/hack/1298)
- [2024-12-23 09:13:29]
- hack成功,自动添加数据
- (/hack/1297)
- [2024-12-22 18:52:18]
- hack成功,自动添加数据
- (/hack/1296)
- [2024-12-22 18:13:14]
- hack成功,自动添加数据
- (/hack/1294)
- [2024-12-21 16:29:44]
- 提交
answer
//Linkwish's code
#include<bits/stdc++.h>
#define endl '\n'
#define si static inline
#define mp make_pair
#define fi first
#define se second
using namespace std;typedef long long ll;typedef __int128 li;
typedef long double ld;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;typedef const int ci;
typedef const ll cl;const int iinf=INT_MAX;const ll linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,1;return 0;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,1;return 0;}
typedef unsigned long long ull;
namespace LinkWish{
const int MAXN = 200005, B = 6;
//const int C[4][4] = {1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 1, 0, 1, 3, 3, 1};
int C[B][B];
int a[MAXN];
namespace sgt {
ull val[MAXN << 2][B]; long long tag[MAXN << 2]; long long mn[MAXN << 2], mx[MAXN << 2];
// sum (x^k)
void addtag(int rt, long long w) {
tag[rt] += w; mn[rt] += w; mx[rt] += w;
for (int i = B - 1; ~i; i--) {
ull pw = w; for (int j = i - 1; ~j; j--, pw *= w) {
val[rt][i] += val[rt][j] * C[i][j] * pw;
}
}
}
void pushdown(int rt) {
if (tag[rt]) addtag(rt << 1, tag[rt]), addtag(rt << 1 | 1, tag[rt]), tag[rt] = 0;
}
void pushup(int rt) {
for (int _ = 0; _ < B; _++) val[rt][_] = val[rt << 1][_] + val[rt << 1 | 1][_];
mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]);
mn[rt] = min(mn[rt << 1], mn[rt << 1 | 1]);
}
void modify(int rt, int l, int r, int x, int y, int w) {
if (x <= l && r <= y) return addtag(rt , w); int mid = (l + r) >> 1; pushdown(rt);
if (x <= mid) modify(rt << 1, l, mid, x, y, w);
if (y > mid) modify(rt << 1 | 1, mid + 1, r, x, y, w); pushup(rt);
}
ull ret[B]; long long X, N;
void query(int rt, int l, int r, int x, int y) {
if (x <= l && r <= y) {
X = max(X, mx[rt]); N = min(N, mn[rt]);
for (int i = 0; i < B; i++) ret[i] += val[rt][i];
return;
}
int mid = (l + r) >> 1; pushdown(rt);
if (x <= mid) query(rt << 1, l, mid, x, y);
if (y > mid) query(rt << 1 | 1, mid + 1, r, x, y);
}
void build(int rt, int l, int r) {
if (l == r) {
mn[rt] = mx[rt] = a[l];
ull pw = 1; for (int i = 0; i < B; i++, pw *= a[l]) val[rt][i] = pw; return;
} int mid = (l + r) >> 1; build(rt << 1, l, mid); build(rt << 1 | 1, mid + 1, r); pushup(rt);
}
}
void mian() {
for (int i = 0; i < B; i++) {
C[i][0] = 1; for (int j = 1; j <= i; j++) C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
}
int n, m; scanf("%d %d", &n, &m);
//printf("? %d %d\n", n, m);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] *= 2;
sgt::build(1, 1, n);
while (m--) {
int op, l, r, v; scanf("%d %d %d", &op, &l, &r);
//printf("? %d %d %d\n", op, l, r);
if (op == 1) {
scanf("%d", &v); sgt::modify(1, 1, n, l, r, v * 2);
}
else {
sgt::X = 0; sgt::N = 0x3f3f3f3f3f3f3f3f;
memset(sgt::ret, 0, sizeof sgt::ret);
sgt::query(1, 1, n, l, r);
//for (int i = 0; i < B; i++) printf("%llu\n", sgt::ret[i]);
long long mid = (sgt::X + sgt::N) / 2; ull fvv = -mid;
for (int i = B - 1; ~i; i--) {
ull pw = fvv; for (int j = i - 1; ~j; j--, pw *= fvv) {
sgt::ret[i] += sgt::ret[j] * C[i][j] * pw;
}
}
bool flg = 1; for (int i = 1; i < B; i += 2) flg &= sgt::ret[i] == 0;
//bool flg = sgt::ret[1] == 0 && sgt::ret[3] == 0;
if (flg == 1) puts("Yes");else puts("No");
}
}
}
}
signed main(){
#ifndef ONLINE_JUDGE
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
LinkWish::mian();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 7920kb
input:
8 4 1 2 3 4 5 6 7 8 2 1 8 1 1 4 4 2 1 6 2 1 8
output:
Yes No Yes
result:
ok 3 token(s): yes count is 2, no count is 1
Test #2:
score: 0
Accepted
time: 348ms
memory: 50028kb
input:
200000 200000 0 0 0 1 1 0 2 1 1 2 0 1 0 0 0 2 1 0 1 2 2 1 2 1 2 0 0 2 1 2 1 0 0 2 0 2 1 1 1 2 0 0 0 0 2 0 1 0 0 2 2 1 1 0 0 2 1 0 2 0 2 1 2 1 0 1 2 1 0 1 2 1 2 1 0 1 2 0 1 0 1 1 0 2 1 2 0 2 2 1 1 2 1 2 2 0 0 1 2 0 0 2 2 0 1 2 2 0 0 1 2 1 2 0 2 0 0 2 0 2 1 0 1 1 1 1 2 1 2 0 1 2 1 0 2 1 0 1 1 2 2 0 1 ...
output:
No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 100047 token(s): yes count is 22, no count is 100025
Test #3:
score: 0
Accepted
time: 366ms
memory: 50036kb
input:
200000 200000 5 5 2 0 1 1 4 1 1 0 4 2 2 5 5 4 1 2 2 0 3 3 3 2 5 4 1 5 1 0 0 4 3 4 2 2 3 1 4 2 0 5 4 0 2 5 5 5 2 2 3 4 0 2 2 5 0 2 3 5 4 0 0 2 1 0 5 3 1 4 5 2 2 3 4 5 0 5 5 5 3 3 0 1 4 3 0 0 3 2 2 0 4 5 5 5 2 4 5 2 5 3 1 1 5 2 1 0 1 0 5 0 0 1 5 1 5 3 1 5 3 5 4 0 2 2 4 2 5 2 3 4 5 4 3 5 2 5 2 4 5 3 4 ...
output:
No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 99734 token(s): yes count is 10, no count is 99724
Test #4:
score: 0
Accepted
time: 370ms
memory: 47732kb
input:
200000 200000 185447 70128 80288 38126 188018 126450 46081 189881 15377 21028 12588 100061 7218 74518 162803 34448 90998 44793 167718 16370 136024 153269 186316 137564 3082 169700 175712 19214 82647 72919 170919 142138 57755 168197 81575 126456 183138 106882 167154 184388 198667 190302 188371 183732...
output:
No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 99837 token(s): yes count is 11, no count is 99826
Test #5:
score: 0
Accepted
time: 357ms
memory: 47348kb
input:
200000 200000 0 2 0 2 0 2 1 1 1 1 0 2 2 0 1 1 1 1 2 0 0 2 1 1 0 2 0 2 0 2 2 0 1 1 0 2 1 1 2 0 2 0 1 1 2 0 1 1 2 0 0 2 0 2 2 0 1 1 2 0 1 1 0 2 0 2 2 0 0 2 2 0 1 1 1 1 1 1 2 0 0 2 0 2 0 2 0 2 2 0 0 2 1 1 0 2 0 2 2 0 2 0 1 1 1 1 0 2 0 2 2 0 1 1 0 2 2 0 0 2 2 0 1 1 2 0 1 1 0 2 1 1 2 0 1 1 0 2 1 1 2 0 1 ...
output:
No Yes Yes No No No No No No No No Yes No No No No No No No No No Yes No No No No No No No No No Yes No No No No No No Yes No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No Yes ...
result:
ok 99868 token(s): yes count is 34, no count is 99834
Test #6:
score: 0
Accepted
time: 371ms
memory: 49060kb
input:
200000 200000 5 0 5 0 2 3 0 5 1 4 1 4 4 1 1 4 1 4 0 5 4 1 2 3 2 3 5 0 5 0 4 1 1 4 2 3 2 3 0 5 3 2 3 2 3 2 2 3 5 0 4 1 1 4 5 0 1 4 0 5 0 5 4 1 3 2 4 1 2 3 2 3 3 2 1 4 4 1 2 3 0 5 5 0 4 1 0 5 2 3 5 0 5 0 5 0 2 3 2 3 3 2 4 1 0 5 2 3 2 3 5 0 0 5 2 3 3 2 5 0 4 1 0 5 0 5 2 3 1 4 0 5 5 0 3 2 1 4 4 1 5 0 2 ...
output:
No Yes Yes No No No No No Yes No No No No No No No No No No Yes Yes No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No...
result:
ok 99999 token(s): yes count is 32, no count is 99967
Test #7:
score: 0
Accepted
time: 370ms
memory: 46332kb
input:
200000 200000 185447 14553 70128 129872 80288 119712 38126 161874 188018 11982 126450 73550 46081 153919 189881 10119 15377 184623 21028 178972 12588 187412 100061 99939 7218 192782 74518 125482 162803 37197 34448 165552 90998 109002 44793 155207 167718 32282 16370 183630 136024 63976 153269 46731 1...
output:
No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 99951 token(s): yes count is 16, no count is 99935
Test #8:
score: 0
Accepted
time: 362ms
memory: 47400kb
input:
200000 200000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
No Yes Yes No No No Yes Yes Yes No Yes Yes No No No No Yes No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No...
result:
ok 99715 token(s): yes count is 40, no count is 99675
Test #9:
score: 0
Accepted
time: 368ms
memory: 46368kb
input:
200000 200000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
Yes No Yes No Yes Yes No Yes No No No Yes No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 100013 token(s): yes count is 34, no count is 99979
Test #10:
score: 0
Accepted
time: 372ms
memory: 49076kb
input:
200000 200000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
Yes Yes No Yes No Yes No No No No Yes No No No No Yes Yes No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 99963 token(s): yes count is 34, no count is 99929
Test #11:
score: 0
Accepted
time: 15ms
memory: 7760kb
input:
6 122861 0 0 0 0 0 0 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 2 2 6 1 3 3 5 1 4 4 5 1 5 5 5 1 6 6 5 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 2 2 6 1 3 3 5 1 4 4 5 1 5 5 5 1 6 6 5 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6...
output:
Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No ...
result:
ok 46656 token(s): yes count is 4986, no count is 41670
Test #12:
score: 0
Accepted
time: 130ms
memory: 41752kb
input:
200000 200000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
Yes Yes No Yes No Yes Yes Yes Yes Yes Yes No Yes Yes No Yes No Yes Yes No No Yes Yes Yes Yes No No Yes Yes No Yes No Yes Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes No Yes Yes No Yes No Yes Yes Yes Yes No Yes No No Yes No No Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Yes No No No No No Y...
result:
ok 200000 token(s): yes count is 142548, no count is 57452
Test #13:
score: 0
Accepted
time: 127ms
memory: 42276kb
input:
200000 200000 192638 7362 141854 58146 18695 181305 143615 56385 20728 179272 179861 20139 78463 121537 79967 120033 121724 78276 131821 68179 140320 59680 124938 75062 119503 80497 14769 185231 50662 149338 82361 117639 43840 156160 110453 89547 64825 135175 177198 22802 147890 52110 197055 2945 12...
output:
No No No No Yes Yes No No No No Yes No No No No No Yes Yes No No No No Yes No No Yes No No No No No No No No Yes Yes Yes No No No No Yes No No No No No Yes No No No No No No Yes No No No No No No No No No No Yes No No No No No No Yes Yes No No No No No No Yes Yes No No Yes Yes No No No No Yes No Yes...
result:
ok 200000 token(s): yes count is 48250, no count is 151750
Test #14:
score: 0
Accepted
time: 50ms
memory: 44372kb
input:
200000 200000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ...
result:
ok 99626 token(s): yes count is 99626, no count is 0
Test #15:
score: -100
Wrong Answer
time: 114ms
memory: 46756kb
input:
197608 196219 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
Yes
result:
wrong answer expected NO, found YES [1st token]