QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#721828 | #9557. Temperance | libantian# | AC ✓ | 767ms | 75156kb | C++23 | 1.3kb | 2024-11-07 16:57:41 | 2024-11-07 16:57:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define fi first
#define se second
#define all(_a) _a.begin(), _a.end()
const int N=100010;
struct Node
{
int x,y,z;
};
void solve(){
int n;
cin>>n;
vector<int>st(n+1);
map<int,vector<int>>mp[3];
map<int,int>cnt[3];
for(int i=1;i<=n;i++){
int x,y,z;
cin>>x>>y>>z;
mp[0][x].push_back(i);
mp[1][y].push_back(i);
mp[2][z].push_back(i);
cnt[0][x]++;
cnt[1][y]++;
cnt[2][z]++;
}
priority_queue<array<int,3>,vector<array<int,3>>,greater<array<int,3>>>q;
for(int i=0;i<3;i++){
for(auto v:cnt[i]){
q.push({v.se,i,v.fi});
}
}
int res=0;
for(int i=0;i<n;i++){
while(q.size()&&q.top()[0]<=i){
int p=q.top()[1];
int pos=q.top()[2];
q.pop();
for(auto v:mp[p][pos]){
if(++st[v]==3)res++;
}
}
cout<<res<<" ";
}
cout<<endl;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cout << setiosflags(ios::fixed) << setprecision(15);
int T;
T=1;
cin>>T;
while(T--)solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3772kb
input:
2 5 1 1 1 1 1 2 1 1 3 2 3 5 2 2 4 3 1 1 1 2 2 2 3 3 3
output:
0 0 2 5 5 0 3 3
result:
ok 8 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
16 1 1 1 1 2 1 1 1 1 1 100000 3 1 1 1 1 1 100000 1 100000 1 4 1 1 1 1 1 100000 1 100000 1 1 100000 100000 5 1 1 1 1 1 100000 1 100000 1 1 100000 100000 100000 1 1 6 1 1 1 1 1 100000 1 100000 1 1 100000 100000 100000 1 1 100000 1 100000 7 1 1 1 1 1 100000 1 100000 1 1 100000 100000 100000 1 1 100000 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 1 5 0 0 0 0 6 6 0 0 0 0 7 7 7 0 0 0 0 8 8 8 8 0 0 0 0 0 0 0 0 0 0 0 0 0 1 5 0 0 0 0 6 6 0 0 0 0 7 7 7 0 0 0 0 8 8 8 8
result:
ok 72 numbers
Test #3:
score: 0
Accepted
time: 106ms
memory: 3504kb
input:
10000 22 1 4 4 7 2 6 6 5 4 4 4 1 1 7 1 7 6 6 5 8 6 4 4 8 6 7 6 1 7 3 5 7 8 5 1 3 2 1 7 1 2 5 6 1 2 3 1 1 7 3 8 1 4 6 6 5 7 4 4 7 7 7 5 3 4 6 13 2 7 3 2 7 5 5 1 5 8 7 1 6 6 7 3 5 8 8 1 6 4 8 4 1 4 3 6 2 5 6 8 4 1 5 5 5 3 4 28 4 7 2 3 8 5 1 1 6 1 7 4 5 5 6 6 1 5 4 5 2 1 1 5 2 6 3 4 3 6 4 5 7 3 3 6 6 8...
output:
0 0 0 0 7 12 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 0 0 3 9 13 13 13 13 13 13 13 13 13 0 0 0 0 8 21 21 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 0 0 1 9 9 14 14 14 14 14 14 14 14 14 0 0 0 6 9 12 12 19 19 19 19 19 19 19 19 19 19 19 19 0 0 0 0 3 8 10 22 36 36 36 36 3...
result:
ok 199157 numbers
Test #4:
score: 0
Accepted
time: 138ms
memory: 3556kb
input:
10000 11 16 4 3 13 14 10 6 2 19 4 16 7 13 11 13 18 6 20 19 11 5 17 4 19 2 2 17 8 18 5 14 14 1 39 3 12 9 4 9 17 5 7 2 4 12 15 5 12 14 15 20 16 19 11 12 5 8 13 13 18 12 9 14 15 12 18 13 19 11 18 14 17 14 2 19 4 9 3 10 19 5 2 19 10 12 6 10 6 20 16 18 5 20 6 5 8 5 17 14 19 10 5 5 13 9 9 2 5 16 20 14 14 ...
output:
0 2 11 11 11 11 11 11 11 11 11 0 0 2 11 22 33 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 0 0 3 12 15 15 15 15 15 15 15 15 15 15 15 15 0 1 3 21 25 32 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 3...
result:
ok 199593 numbers
Test #5:
score: 0
Accepted
time: 193ms
memory: 3568kb
input:
10000 22 40126 51309 54005 77536 83774 68530 35537 89229 39298 26549 72686 40526 72054 78714 67371 54406 93387 54598 62891 79741 7031 21699 38166 16961 98001 73695 16118 23105 44313 87949 61147 44816 82830 40866 30839 37096 63254 98489 15491 2724 410 12208 96504 21764 35334 777 98615 64141 98638 282...
output:
0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 0 10 10 10 10 10 10 10 10 10 0 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 2...
result:
ok 194828 numbers
Test #6:
score: 0
Accepted
time: 129ms
memory: 3608kb
input:
20000 13 2 7 2 11 1 15 7 11 11 14 3 2 8 4 2 14 13 3 1 3 9 1 9 6 10 5 9 3 6 14 11 3 2 10 10 2 4 14 8 18 7 1 7 15 6 14 10 4 2 9 11 6 12 3 2 6 12 4 14 14 8 15 6 4 9 12 1 14 4 6 3 5 13 15 1 5 5 7 3 14 7 14 6 13 5 15 15 5 3 13 5 5 4 13 17 12 12 9 10 12 9 6 11 4 15 1 14 6 3 15 6 6 10 6 8 3 15 5 9 12 6 7 1...
output:
0 3 7 8 8 13 13 13 13 13 13 13 13 0 0 7 12 18 18 18 18 18 18 18 18 18 18 18 18 18 18 0 0 5 6 17 17 17 17 17 17 17 17 17 17 17 17 17 0 0 3 0 1 5 5 5 0 2 8 15 15 15 15 15 15 15 15 15 15 15 15 0 1 6 9 9 9 9 9 9 0 0 5 17 17 17 17 17 17 17 17 17 17 17 17 17 17 0 1 5 5 5 0 2 0 0 0 13 16 16 16 1...
result:
ok 191387 numbers
Test #7:
score: 0
Accepted
time: 168ms
memory: 3552kb
input:
20000 2 69026 89423 26470 19943 3587 25231 9 96641 23438 60068 67211 19770 48041 15125 93974 46480 5771 64091 75193 17303 53889 28772 24105 87959 20685 14225 35987 93612 79842 79992 89652 81542 34986 15554 15 7463 88448 20014 74043 61063 90326 80812 97411 13843 38384 61124 37764 18186 80264 55309 12...
output:
0 2 0 9 9 9 9 9 9 9 9 0 15 15 15 15 15 15 15 15 15 15 15 15 15 15 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 0 7 7 7 7 7 7 0 8 8 8 8 8 8 8 0 13 13 13 13 13 13 13 13 13 13 13 13 0 4 4 4 0 3 3 0 3 3 0 5 5 5 5 0 2 0 2 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 0 3 3 0 13 13 13 13...
result:
ok 189019 numbers
Test #8:
score: 0
Accepted
time: 17ms
memory: 6456kb
input:
2 61322 15 48 50 13 48 35 41 1 39 4 4 46 13 46 39 48 43 8 37 28 42 47 6 18 15 27 25 11 34 45 33 28 9 33 37 15 40 16 26 13 10 22 10 41 17 21 22 8 37 31 48 11 48 29 1 45 49 26 28 3 35 20 36 17 42 40 42 45 36 49 32 28 46 37 5 35 50 49 30 36 32 17 35 11 38 49 27 25 7 21 41 7 3 25 48 9 4 17 13 12 30 23 3...
output:
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 0 0 0 0 0 0 0 ...
result:
ok 64422 numbers
Test #9:
score: 0
Accepted
time: 418ms
memory: 39692kb
input:
2 82319 81784 15676 55428 36920 13434 44904 46877 92320 35269 44212 4490 14286 46939 25409 46324 66302 38351 14822 2554 1983 16106 23690 16816 73141 23210 66029 15099 93719 34782 576 22743 40722 70251 59272 25745 16644 50442 3167 5358 42914 48423 52435 546 35826 2467 42278 59162 52914 56020 16044 76...
output:
0 6924 42079 70072 79822 81906 82247 82310 82310 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319...
result:
ok 130773 numbers
Test #10:
score: 0
Accepted
time: 767ms
memory: 75156kb
input:
2 100000 95821 95821 95821 54965 54965 54965 63811 63811 63811 11219 11219 11219 27274 27274 27274 76752 76752 76752 70949 70949 70949 59746 59746 59746 84495 84495 84495 60363 60363 60363 93707 93707 93707 91384 91384 91384 81227 81227 81227 13202 13202 13202 80413 80413 80413 67024 67024 67024 955...
output:
0 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 1000...
result:
ok 200000 numbers
Test #11:
score: 0
Accepted
time: 252ms
memory: 29172kb
input:
2 100000 95821 100000 100000 54965 100000 100000 63811 100000 100000 11219 100000 100000 27274 100000 100000 76752 100000 100000 70949 100000 100000 59746 100000 100000 84495 100000 100000 60363 100000 100000 93707 100000 100000 91384 100000 100000 81227 100000 100000 13202 100000 100000 80413 10000...
output:
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 0 0 0 0 0 0 0 ...
result:
ok 200000 numbers
Test #12:
score: 0
Accepted
time: 167ms
memory: 17020kb
input:
2 100000 15607 10014 1 15607 9262 14 15607 9234 10 15607 8689 1 15607 9029 4 14951 6967 16 29294 6967 6 15607 7733 8 18137 6967 6 4732 6967 2 15607 3881 13 16779 6967 6 15607 8967 1 9472 6967 11 7513 6967 2 14262 6967 2 15607 10174 4 15607 14425 1 15607 11464 10 15607 7552 20 13620 6967 2 15117 6967...
output:
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 0 0 0 0 0 0 0 ...
result:
ok 200000 numbers
Test #13:
score: 0
Accepted
time: 94ms
memory: 8992kb
input:
2 100000 2150 1762 156 2597 1769 155 2150 2164 41 2150 1645 200 2940 1769 232 2150 2357 244 2150 2542 211 2150 1602 200 3800 1769 68 1988 1769 35 2150 1476 291 1934 1769 161 2150 2330 129 2854 1769 121 2150 1741 156 2150 1832 37 2040 1769 271 1954 1769 53 2135 1769 220 2150 1993 43 2018 1769 144 215...
output:
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 0 0 0 0 0 0 0 ...
result:
ok 200000 numbers
Test #14:
score: 0
Accepted
time: 168ms
memory: 17036kb
input:
2 100000 2 2 20043 2 1 46314 3 2 35997 2 2 187 3 2 2659 2 2 30453 2 3 35736 2 2 42562 2 2 45524 2 2 18450 2 2 46079 2 1 48534 2 2 9224 2 2 25209 1 2 26067 1 2 47241 2 1 38187 2 3 13413 2 3 5436 3 2 25393 2 1 16032 2 1 11613 2 1 13527 2 1 1691 2 2 11078 2 2 42812 2 2 15877 2 2 31491 2 3 42954 2 2 315...
output:
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 0 0 0 0 0 0 0 ...
result:
ok 200000 numbers
Test #15:
score: 0
Accepted
time: 102ms
memory: 8156kb
input:
2 99235 437 669 437 189 213 189 404 634 404 327 608 327 243 342 243 122 128 122 431 582 431 433 839 433 302 414 302 375 648 375 419 758 419 53 83 53 291 476 291 157 259 157 326 609 326 199 237 199 192 278 192 430 786 430 223 420 223 233 393 233 349 478 349 414 432 414 82 101 82 118 191 118 236 412 2...
output:
0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 406 435 465 496 528 561 595 630 666 703 741 780 820 861 903 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 2556 262...
result:
ok 198470 numbers
Test #16:
score: 0
Accepted
time: 234ms
memory: 28876kb
input:
2 100000 80563 80563 97252 12843 12843 19316 12843 12843 16382 44624 44624 46497 60814 60814 63977 60814 60814 71202 30582 30582 32221 30582 30582 32531 60814 60814 75724 44624 44624 51465 30582 30582 35921 4002 4002 9752 12843 12843 15363 80563 80563 96382 60814 60814 63381 79534 76436 76436 60814 ...
output:
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 0 0 0 0 0 0 0 ...
result:
ok 200000 numbers
Test #17:
score: 0
Accepted
time: 339ms
memory: 29144kb
input:
2 100000 87516 87516 87624 89008 89008 89031 23379 23457 23379 44799 44799 44841 57419 57419 57510 61889 61889 61996 4521 4482 4482 46081 46062 46062 51673 51399 51399 18489 18512 18489 92503 92625 92503 28615 28547 28547 39770 39770 39833 7066 7827 7066 27547 27496 27496 9503 9503 9520 58144 58192 ...
output:
0 7 23 44 76 141 177 268 332 440 550 649 805 870 968 1163 1419 1538 1736 1907 2087 2402 2578 2647 2719 2894 2998 3160 3328 3473 3563 3749 4101 4266 4538 4818 5034 5589 5893 6088 6368 6614 6908 7037 7301 7571 8031 8360 8696 9235 9535 9892 10308 10520 10952 11502 11950 12292 12350 12586 12766 12949 13...
result:
ok 200000 numbers
Test #18:
score: 0
Accepted
time: 225ms
memory: 41660kb
input:
2 100000 1 1 1 2 2 1 3 3 1 4 4 1 5 5 1 6 6 1 7 7 1 8 8 1 9 9 1 10 10 1 11 11 1 12 12 1 13 13 1 14 14 1 15 15 1 16 16 1 17 17 1 18 18 1 19 19 1 20 20 1 21 21 1 22 22 1 23 23 1 24 24 1 25 25 1 26 26 1 27 27 1 28 28 1 29 29 1 30 30 1 31 31 1 32 32 1 33 33 1 34 34 1 35 35 1 36 36 1 37 37 1 38 38 1 39 39...
output:
0 0 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50...
result:
ok 200000 numbers
Test #19:
score: 0
Accepted
time: 416ms
memory: 33040kb
input:
2 100000 82319 81784 15676 82319 55428 36920 82319 13434 44904 82319 46877 92320 82319 35269 44212 82319 4490 14286 82319 46939 25409 82319 46324 66302 82319 38351 14822 82319 2554 1983 82319 16106 23690 82319 16816 73141 82319 23210 66029 82319 15099 93719 82319 34782 576 82319 22743 40722 82319 70...
output:
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 200000 numbers
Extra Test:
score: 0
Extra Test Passed