QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#794188 | #1087. Brief Statements Union | badminton | WA | 1956ms | 106680kb | C++14 | 3.8kb | 2024-11-30 12:44:24 | 2024-11-30 12:44:24 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef pair <ll,ll> pll;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
#define forr(_a,_b,_c) for(int _a = (_b); _a <= int (_c); ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> int (_c);)
#define forf(_a,_b,_c) for(int _a = (_b); _a < int (_c); ++_a)
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define mask(i) (1LL << (i))
#define bit(x, i) (((x) >> (i)) & 1)
#define bp __builtin_popcountll
#define file "test"
template<class X, class Y>
bool minz(X &x, const Y &y) {
if (x > y) {
x = y;
return true;
} return false;
}
template<class X, class Y>
bool maxz(X &x, const Y &y) {
if (x < y) {
x = y;
return true;
} return false;
}
const int N = 1e6 + 5;
const ll oo = (ll) 1e16;
const ll mod = 1e9 + 7; // 998244353;
ll x[N], l[N], r[N], id[N], add[N], n, k, ok[N], vis[N], pre[N], suf[N], add2[N];
vector <ll> ask[N];
void solve(int o){
memset (add, 0, sizeof add);
memset (id, 0, sizeof id);
memset (vis, 0, sizeof vis);
memset (add2, 0, sizeof add2);
memset (suf, 0, sizeof suf);
memset (pre, 0, sizeof pre);
forr (i, 1, k){
if (bit(x[i], o)){
add[l[i]]++;
add[r[i] + 1]--;
add2[l[i] - 1]--;
add2[r[i]]++;
if (!id[l[i]] || r[id[l[i]]] < r[i])
id[l[i]] = i;
} else {
ask[r[i]].pb(i);
}
// cout << bit(x[i], o) << " ";
// cout << "\n";
}
int lst = 0, cur = 0, lmao = 0, cook = 0;
vector <int> bad;
forr (i, 1, n){
add[i] += add[i - 1];
if (!add[i]) lst = i;
if (add[i] == 1) lmao = i;
if (id[i] && r[id[i]] >= r[cur]){
cur = id[i];
}
id[i] = cur;
for (int u : ask[i]){
if (lst < l[u]){
bad.pb(u);
if (lmao < l[u]){
cook = 1;
}
}
}
pre[i] = lmao;
//cout << add[i] << " " << id[i] << endl;
ask[i].clear();
}
lmao = n + 1;
ford (i, n, 1){
add2[i] += add2[i + 1];
if (add2[i] == 1) lmao = i;
suf[i] = lmao;
}
//cout << "bad\n";
// for (int u : bad) cout << l[u] << " " << r[u] << endl;
if (bad.empty()){
forr (i, 1, k){
ok[i]++;
}
} else {
if (bad.size() == 1) ok[bad[0]]++;
else if (cook) return;
int ml = bad[0], mr = bad[0];
for (int u : bad){
if (l[u] > l[ml]) ml = u;
if (r[u] < r[mr]) mr = u;
}
//cout << ml << " " << l[ml] << " " << mr << " " << r[mr] << endl;
//cout << id[pre[l[ml]]] << " " << id[suf[r[mr]]] << "\n";
if (l[ml] <= r[mr]){
forr (i, l[ml], r[mr]){
if (add[i] == 1 && !vis[id[i]]){
vis[id[i]] = 1;
ok[id[i]]++;
}
}
} else
if (id[pre[l[ml]]] == id[suf[r[mr]]]){
ok[id[pre[ml]]]++;
}
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
freopen(file".inp", "r", stdin); freopen(file".out", "w", stdout);
#endif
cin >> n >> k;
forr (i, 1, k){
cin >> l[i] >> r[i] >> x[i];
}
forf (i, 0, 60){
solve(i);
//forr (i, 1, k){
// cout << ok[i] << " ";
//}
//cout << endl;
}
forr (i, 1, k){
cout << (ok[i] == 60);
}
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 216ms
memory: 81216kb
input:
4 3 1 2 1 2 4 3 2 2 1
output:
011
result:
ok "011"
Test #2:
score: 0
Accepted
time: 211ms
memory: 81068kb
input:
4 3 1 2 1 3 4 3 2 3 1
output:
111
result:
ok "111"
Test #3:
score: 0
Accepted
time: 231ms
memory: 80376kb
input:
8 8 1 3 23 2 8 8 2 4 10 3 3 26 1 3 26 1 4 10 4 7 8 4 5 40
output:
10000000
result:
ok "10000000"
Test #4:
score: 0
Accepted
time: 217ms
memory: 79712kb
input:
8 8 3 5 9 3 3 63 6 7 57 1 4 44 5 5 63 1 7 40 1 7 40 7 8 0
output:
10000000
result:
ok "10000000"
Test #5:
score: 0
Accepted
time: 217ms
memory: 80852kb
input:
8 8 3 8 21 6 8 4 1 7 20 1 7 20 6 6 61 4 6 29 2 2 31 5 6 61
output:
11000000
result:
ok "11000000"
Test #6:
score: 0
Accepted
time: 210ms
memory: 81756kb
input:
8 8 7 8 21 2 6 26 3 3 63 4 5 58 1 1 55 2 8 10 3 3 63 2 8 10
output:
10000000
result:
ok "10000000"
Test #7:
score: 0
Accepted
time: 211ms
memory: 81088kb
input:
8 8 6 7 21 7 8 59 5 8 43 7 7 63 3 5 45 1 1 31 3 6 45 2 3 61
output:
10000000
result:
ok "10000000"
Test #8:
score: 0
Accepted
time: 235ms
memory: 81128kb
input:
8 8 2 8 2 2 8 4 6 6 14 4 8 4 6 8 4 3 3 31 5 7 12 4 4 13
output:
10000000
result:
ok "10000000"
Test #9:
score: 0
Accepted
time: 220ms
memory: 81680kb
input:
8 8 1 8 12 3 6 36 1 5 36 3 8 4 7 8 6 3 4 47 1 3 45 1 4 45
output:
10000000
result:
ok "10000000"
Test #10:
score: 0
Accepted
time: 202ms
memory: 80444kb
input:
8 8 3 6 10 3 8 2 1 6 8 3 4 42 1 4 8 4 7 2 3 8 2 4 6 10
output:
11111111
result:
ok "11111111"
Test #11:
score: 0
Accepted
time: 215ms
memory: 80260kb
input:
8 8 3 5 31 4 4 63 3 4 60 3 8 24 4 6 27 4 8 25 3 5 24 4 5 27
output:
10000000
result:
ok "10000000"
Test #12:
score: 0
Accepted
time: 206ms
memory: 79796kb
input:
1000 1000 300 351 21 10 222 0 340 955 0 732 959 0 183 259 1075924053 576 785 809566210 165 668 65600 603 998 0 33 724 0 521 886 809566208 26 48 16512 210 603 1075905600 182 499 1075907648 106 867 65536 380 902 268500992 419 826 268500992 70 824 0 396 898 268500992 175 597 1075905600 407 565 14117162...
output:
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok "100000000000000000000000000000...0000000000000000000000000000000"
Test #13:
score: 0
Accepted
time: 207ms
memory: 82728kb
input:
1000 1000 332 333 3888728191 555 691 3691878688 734 782 2617286016 418 815 67110912 173 504 67108868 507 891 67112960 22 256 16384 566 918 67141888 163 904 67108864 377 792 2214594560 342 947 67108864 154 163 117456900 310 727 3288860672 340 957 67108864 209 712 1140852736 235 942 67108864 233 666 1...
output:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
result:
ok "111111111111111111111111111111...1111111111111111111111111111111"
Test #14:
score: 0
Accepted
time: 218ms
memory: 81204kb
input:
1000 1000 142 143 1391808798 442 443 3993194233 508 606 4470796 384 610 4458504 457 757 262144 413 562 138680328 381 480 138709000 554 684 17041414 130 538 0 514 648 4466692 9 560 0 164 293 32784 27 203 0 273 289 172001304 425 559 138680328 704 786 1359216806 116 657 0 52 74 32768 90 172 33808 206 7...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok "000000000000000000000000000000...0000000000000000000000000000000"
Test #15:
score: 0
Accepted
time: 195ms
memory: 82844kb
input:
1000 1000 133 134 3452617219 201 202 2741198289 133 688 536888320 46 846 16384 391 490 2785605216 14 351 1024 368 394 2986997344 33 729 17408 670 876 2751480353 130 990 0 85 221 19456 72 470 17408 352 534 2718488160 169 881 536887296 39 255 17408 6 924 0 427 774 2751485472 773 903 603996705 79 960 0...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok "000000000000000000000000000000...0000000000000000000000000000000"
Test #16:
score: 0
Accepted
time: 202ms
memory: 79792kb
input:
1000 1000 563 564 3235557804 498 499 136916311 364 731 16418 144 398 67108992 802 987 256 520 822 4194306 281 945 0 229 572 67125248 106 824 0 335 965 0 363 508 69357798 277 814 2 139 807 0 156 269 69339272 231 241 77744264 332 584 67129442 81 239 75497472 18 346 0 437 892 4194306 239 475 69353606 3...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok "000000000000000000000000000000...0000000000000000000000000000000"
Test #17:
score: 0
Accepted
time: 206ms
memory: 82700kb
input:
1000 1000 98 99 3669167333 790 791 956876477 343 632 3244556840 392 603 3244565032 318 974 32 272 867 32 762 870 301991968 139 322 327680 448 909 32 69 141 458752 690 995 0 144 972 0 173 693 0 56 710 0 125 212 458752 595 867 301991968 177 535 327712 659 883 301991968 438 907 32 588 745 1398810656 17...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok "000000000000000000000000000000...0000000000000000000000000000000"
Test #18:
score: 0
Accepted
time: 1956ms
memory: 105756kb
input:
500000 500000 112503 445152 290559777004655366 32132 117020 290763651042771008 49650 165976 290838417837654336 19883 286024 288230376252375104 155602 273108 309101940228948754 45571 295214 290838417837654080 89127 249224 290839048661046016 413483 486365 470634966683172899 190343 249645 8675616599611...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok "000000000000000000000000000000...0000000000000000000000000000000"
Test #19:
score: -100
Wrong Answer
time: 1797ms
memory: 106680kb
input:
500000 500000 75169 288105 0 382727 475600 0 10070 425092 0 64304 142056 0 19654 478193 0 154145 161566 0 346669 416663 0 175647 177331 0 116954 294672 0 195952 386106 0 265651 301401 0 39676 49893 0 13856 393740 0 173755 427620 0 365279 394564 0 351657 419756 0 169294 292129 0 167444 280894 0 24498...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
wrong answer 1st words differ - expected: '000000000000000000000000000000...0000000000000000000000000000000', found: '000000000000000000000000000000...0000000000000000000000000000000'