QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#451097 | #5554. Breeding Bugs | Ebiarat# | WA | 108ms | 84156kb | C++20 | 2.7kb | 2024-06-22 21:02:02 | 2024-06-22 21:02:02 |
Judging History
answer
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <sstream>
#include <ctime>
#include <iterator>
#include <string.h>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <fstream>
#include <assert.h>
#include <numeric>
#include <complex>
#include <random>
#include <utility>
#define IOS ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a) - 1; i>=(b);i--)
#define rep(i,n) FOR(i,0,n)
#define PB push_back
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define VI vector<int>
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VL vector<long long >
#define FILL(a, value) memset(a, value, sizeof(a))
const int nax = 2 * (int)1e5 + 147;
using namespace std;
const int MOD = 998244353;
const int INF = 1e9 +47 ;
const long long LINF = (long long)1e18 + 4747;
typedef long long LL;
const double EPS=1e-6;
int p[(int)1e7 * 2 + 4];
int cc[770 * 770];
vector<int > g[770];
vector<int> mt;
vector<bool> used;
bool try_kuhn(int v) {
if (used[v])
return false;
used[v] = true;
for (int to : g[v]) {
if (mt[to] == -1 || try_kuhn(mt[to])) {
mt[to] = v;
return true;
}
}
return false;
}
int main() {
int m;
cin >> m;
vector<int> b(m);
for(int i = 0;i < m;i ++ )
{
cin >> b[i];
}
sort(b.begin(),b.end());
int id = 0;
while(id < m && b[id] ==1)id++;
if(id!=0)id--;
int del = id;
int n = m - id;
vector<int> par;
vector<int> nepar;
while(id != m) {
if(b[id] % 2 == 0)par.push_back(b[id]);
else nepar.push_back(b[id]);
id++;
}
for(int i = 0; i <=1e7 * 2;i ++ )p[i] = true;
p[0] = p[1] = false;
int mx =(int)1e7;
for (int i = 2; i * i <= mx; i++) {
if(p[i]) {
for (int j = i * i; j <= mx; j += i) {
p[j] = false;
}
}
}
n = par.size();
int k = nepar.size();
for(int i = 0;i < par.size();i ++ ) {
for(int j = 0; j < nepar.size(); j++) {
if(p[par[i] + nepar[j]]) {
// cout << i << ' ' << j << '\n';
g[i].push_back(j);
}
}
}
mt.assign(k, -1);
for (int v = 0; v < n; ++v) {
used.assign(n, false);
try_kuhn(v);
}
int ans = 0;
for(int i = 0;i <k;i ++) {
if(mt[i]!=-1)ans++;
}
cout << m - del - ans << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 46ms
memory: 81972kb
input:
8 1 2 3 4 5 6 7 8
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 52ms
memory: 82884kb
input:
5 7 13 2 2 4
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 46ms
memory: 83544kb
input:
2 1 1
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 69ms
memory: 83740kb
input:
3 1 2 1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 75ms
memory: 82636kb
input:
749 636 51 149 35 143 172 595 226 743 512 547 310 622 304 729 540 110 241 169 201 690 167 47 493 689 162 491 104 354 592 44 358 331 301 373 716 351 630 389 253 224 292 671 440 192 613 150 588 485 549 624 75 282 535 695 426 78 640 408 119 203 580 309 587 357 707 115 720 606 565 434 590 741 133 420 51...
output:
375
result:
ok single line: '375'
Test #6:
score: 0
Accepted
time: 47ms
memory: 83864kb
input:
749 1815 1771 2013 1986 1919 1845 2073 1740 1583 1586 1834 1928 1861 1475 1366 1472 1382 1600 1621 1653 1424 1623 1556 1524 1817 1850 1770 1427 1358 1979 1420 1449 1852 1365 1806 1455 1810 1947 1726 1819 2072 1898 1557 2071 2026 1481 1359 1523 1643 2033 1510 1573 1935 1622 1350 1487 1743 1559 1641 1...
output:
375
result:
ok single line: '375'
Test #7:
score: 0
Accepted
time: 108ms
memory: 83284kb
input:
749 9999669 9999743 9999352 9999704 9999476 9999703 9999438 9999803 9999984 9999633 9999569 9999608 9999275 9999350 9999967 9999873 9999761 9999300 9999764 9999474 9999962 9999288 9999472 9999573 9999480 9999315 9999720 9999757 9999671 9999835 9999700 9999758 9999426 9999755 9999766 9999904 9999957 ...
output:
375
result:
ok single line: '375'
Test #8:
score: 0
Accepted
time: 55ms
memory: 84060kb
input:
749 5939005 140 116 4682136 1761602 154 228 158570 7679414 3670019 17 145 185 9406644 141 9287622 9987191 195 165 7738619 93 8893114 130 9154550 777182 1567373 6572984 2491452 3621298 234 6 138 8537635 83 1229997 1480689 3145258 201471 138 250 8844984 27 1605725 6171522 8026356 131 9987869 191 13 30...
output:
378
result:
ok single line: '378'
Test #9:
score: 0
Accepted
time: 84ms
memory: 82700kb
input:
749 2332958 6180895 7905522 235 115 244 161 9034571 1362164 623051 612462 2571102 42 128 10 111 2956605 9373811 8469417 39 36 96 7530501 40 4790237 2793893 7453444 3762528 7430632 1745194 8733280 9592746 91 9 115 211 1948966 3882472 169 8398684 4034077 175 49 842557 8404493 101 4379660 3376505 44248...
output:
374
result:
ok single line: '374'
Test #10:
score: 0
Accepted
time: 71ms
memory: 83356kb
input:
749 134 5500115 6816197 177 113 39 118 24 95 104 127846 1350242 136 4 142 2941199 6401410 86 454850 244 8902332 115 666972 5265264 166 9291560 32 1678385 1076606 9074495 1505045 46 246 172832 70 8414011 9842934 5110562 2429042 108 3267283 118 8782469 78 8163037 9693554 194 4 245 4168276 7701806 6876...
output:
387
result:
ok single line: '387'
Test #11:
score: 0
Accepted
time: 83ms
memory: 82704kb
input:
749 142 3157863 176 7385582 18 136 93 996229 5259293 16 3251236 173 2213931 2363274 33 3356459 161 1125309 5986003 25 4 188 5858614 100 5634872 2722753 253 4451160 3225247 159 213 203 227 162 2473119 154 125 56 4688436 159 5278056 8605375 9945750 49 8659797 162 90 218 5970119 66 10649 33 4151196 46 ...
output:
385
result:
ok single line: '385'
Test #12:
score: 0
Accepted
time: 66ms
memory: 83504kb
input:
749 2712081 71 236 143 3211032 9722089 180 203 4533157 178 225 26976 7749575 1262900 643082 4795550 5672222 8012648 102 2645098 3694416 6086260 4398225 5703990 4274780 6874662 83 101 203 136 65 231 4038831 6748776 165 9691431 55 81419 3683567 3296282 7416791 1036452 83 121 2453752 4972444 9674832 14...
output:
378
result:
ok single line: '378'
Test #13:
score: 0
Accepted
time: 68ms
memory: 82496kb
input:
749 8339940 9296039 137 9317307 221 2128061 54 6 23 7179362 46 130 8737515 6724928 4941224 216 118 7397608 140 162 856319 9131313 151 6447330 54 145 8765664 244 5669004 3498881 210 132 7563480 176 2467428 678196 152 216 2841428 739831 9816377 2973634 9838285 223 8800877 233 4484218 5627771 4395985 1...
output:
384
result:
ok single line: '384'
Test #14:
score: 0
Accepted
time: 80ms
memory: 82456kb
input:
749 149 124 3605219 1420789 33 7843555 170 186 4291835 8077969 2614124 165 106 521324 35 9 15 7438705 7709424 5610921 12 186 117 7578827 254 5689552 101 8575532 3817548 19 1243187 40 2326755 145 141 251 84 48 169 110 40 1905983 9366846 929982 6026857 122 6633524 968001 103 202 8343291 227 1944018 22...
output:
379
result:
ok single line: '379'
Test #15:
score: 0
Accepted
time: 90ms
memory: 83684kb
input:
749 100 8287048 45 4197216 26 1950491 98 4304791 245 184 142 2712028 134995 45 123 18 2656141 8805691 28 120 8297367 5882622 216 56 123 85 239 802637 3584661 3641679 220 230 3864526 9175642 113 4926485 8779305 1498095 5025013 66 31 126 66 4065967 162 4188980 3530125 167 142 6841207 1618728 1710360 6...
output:
376
result:
ok single line: '376'
Test #16:
score: 0
Accepted
time: 55ms
memory: 82624kb
input:
749 3912636 802328 6855875 244 7342189 209 3250851 4050800 73 779981 2509585 7580357 76 5721513 9738941 9878939 6122795 6732681 239 565510 6098832 495615 152 56 6126945 543165 131 117 4670324 4488986 138 3519388 218 101 17698 118 1380490 184 95 218 195 3414098 7990084 253 166 5527193 2246323 8250955...
output:
402
result:
ok single line: '402'
Test #17:
score: 0
Accepted
time: 86ms
memory: 83156kb
input:
749 8682473 3384807 8359398 95 9101649 8272198 24 178 100 138 194 86 24 7563420 2090794 161 245889 6465662 9354963 200 229 251 8445960 251 6747505 163281 8791794 7309904 5313071 3888038 186 130 5550908 9744515 5518855 206 4434937 3810863 151 5 253 4889695 244 173 6734404 2865039 77 5373531 2230077 6...
output:
376
result:
ok single line: '376'
Test #18:
score: 0
Accepted
time: 68ms
memory: 83292kb
input:
749 145 255 2511242 210 31 130 252 3256468 107 125 1061011 2565811 8724242 122 4273255 8617164 216 2535664 3139976 14 3081472 44 330526 1820598 70 210 5627971 31 116 8216077 2686919 209 6355398 15 4432645 1280401 3018645 9509416 222 5749004 3987238 5711665 249 2152389 9531460 70 2250180 52 153 92572...
output:
378
result:
ok single line: '378'
Test #19:
score: 0
Accepted
time: 59ms
memory: 82728kb
input:
749 186 30 8025614 9733608 95 35 3879624 141 3083486 2478248 100 493791 3364932 81 8269147 193 79 187848 9457098 9125572 7747079 192 4529365 32 5266146 113 4730363 7596358 9354008 60 2407988 222 4 136 8546916 138 226 658725 3939610 110 281204 6893629 228 223 4318669 3590988 3522406 59 5054612 299843...
output:
379
result:
ok single line: '379'
Test #20:
score: 0
Accepted
time: 80ms
memory: 82444kb
input:
749 250 2151714 3525079 157 68 33 126 15 9034268 7223315 7163195 6939192 2987411 39 2945590 7540421 8072687 210 9437680 7410254 100 205 210 5467325 51 7987980 126 231 4411190 5240608 164 3529829 7623941 5522379 110 40 6558055 3496921 173 245 1268345 1246377 5814442 253 252 1817302 1343448 166 472086...
output:
389
result:
ok single line: '389'
Test #21:
score: 0
Accepted
time: 76ms
memory: 83440kb
input:
749 166 106 228 8037675 126 148 26 79 105 2365998 59 115 6566394 197 173 156 2201741 9166937 218 2439759 18 158 4367175 4576683 168 180 185 5617949 5350059 5 81 28 7325306 19 4224943 9697848 224 2207235 134 158 55578 123 2982034 188 152 8640550 1195621 170 4473548 36 9206138 5436165 8414383 5328135 ...
output:
374
result:
ok single line: '374'
Test #22:
score: 0
Accepted
time: 71ms
memory: 82432kb
input:
749 206 2298800 8273789 210 5020800 8003138 1717932 418281 37 79 153 112660 1726363 11 7171359 52 37 3070655 6034023 1895717 6664792 4401253 117 178 206 2626427 8 199 765962 8286478 8230927 4072807 53 3669476 53 15 5854917 229 1122528 41 121 162 58 171459 18 115 221 49 3212942 5794045 1144622 111 98...
output:
389
result:
ok single line: '389'
Test #23:
score: 0
Accepted
time: 74ms
memory: 83612kb
input:
749 2 2 2 2 2 2 2 1 2 1 2 2 1 2 2 2 1 1 1 1 2 2 1 1 1 2 1 2 2 2 1 1 2 1 1 2 1 2 1 2 2 1 2 1 1 1 1 2 2 1 2 1 1 2 1 2 1 1 2 1 1 2 1 2 2 1 1 1 1 1 2 2 1 2 2 1 2 2 1 2 1 1 2 2 2 1 2 1 1 2 2 1 2 1 2 2 2 2 1 1 2 1 2 1 1 1 1 1 1 1 2 2 2 2 2 1 2 1 1 2 1 2 2 2 2 1 1 1 1 1 2 1 1 1 2 1 2 1 2 2 2 1 2 2 2 2 1 2 ...
output:
374
result:
ok single line: '374'
Test #24:
score: 0
Accepted
time: 66ms
memory: 83180kb
input:
749 2 3 5 2 5 3 3 2 2 2 3 5 3 3 5 5 3 2 2 3 5 3 5 5 3 2 2 5 5 3 2 2 3 2 5 5 3 2 2 3 2 3 3 5 2 5 2 2 3 3 3 5 3 2 2 2 3 5 3 2 2 2 5 2 2 5 5 5 3 5 2 2 5 5 3 3 3 5 3 3 2 3 3 3 5 2 3 5 5 2 3 2 5 3 3 5 3 3 3 5 2 3 3 2 2 5 3 3 5 5 2 3 5 2 2 2 2 3 3 5 5 2 5 2 3 2 3 2 2 2 3 5 3 3 5 3 3 2 5 5 2 2 2 3 5 2 3 3 ...
output:
491
result:
ok single line: '491'
Test #25:
score: 0
Accepted
time: 91ms
memory: 84156kb
input:
749 2 5 5 3 2 3 5 5 2 5 2 2 5 2 2 3 2 5 3 3 2 2 2 5 2 5 2 3 2 3 2 5 2 3 3 5 3 5 3 3 5 2 3 2 2 5 2 2 2 2 2 2 2 2 2 2 2 3 5 2 2 3 2 2 3 2 5 5 2 2 2 5 5 5 2 2 2 5 3 5 2 5 2 2 5 2 2 2 2 3 2 3 2 2 5 2 3 3 2 2 5 3 3 3 3 5 2 5 2 2 3 5 2 2 3 2 2 2 5 3 5 5 2 2 2 2 3 2 3 3 3 2 2 2 2 2 5 3 5 2 2 3 5 2 3 2 3 3 ...
output:
383
result:
ok single line: '383'
Test #26:
score: 0
Accepted
time: 74ms
memory: 82464kb
input:
749 8817 30847 29857 15367 64 21190 26872 3142 5329 37402 622 21820 1810 8839 9682 7009 8209 12619 16807 33982 1264 2737 31144 3127 2584 9514 19480 2277 22450 24577 23737 177 10357 39010 2959 27304 7677 21592 33172 36757 11127 15087 637 3217 49162 10687 1887 9289 11554 919 6027 229 7930 24280 23764 ...
output:
376
result:
ok single line: '376'
Test #27:
score: 0
Accepted
time: 92ms
memory: 83352kb
input:
749 5951 46148 662 38261 6509 5618 47105 10728 3011 23558 24152 7475 22502 10152 1908 6299 3992 14648 612 32 26462 16709 15875 4328 18755 24059 33095 25115 28368 7079 13262 14262 38711 15359 4742 38798 10922 3152 7542 6792 2018 27848 11958 28811 31691 3131 15749 5621 26165 2432 5909 13232 38672 1686...
output:
375
result:
ok single line: '375'
Test #28:
score: 0
Accepted
time: 63ms
memory: 83848kb
input:
749 40082 431 31898 25385 7661 24872 261 6605 11975 1772 26471 11516 8786 5606 48725 1545 16688 5115 5331 15128 35966 2061 46811 41585 9341 7221 38495 29246 15632 9741 285 12645 19575 5522 4178 24422 5312 25625 13586 191 38231 31976 45548 37892 8411 8915 10892 27605 14625 15842 38981 8918 891 3225 4...
output:
375
result:
ok single line: '375'
Test #29:
score: 0
Accepted
time: 81ms
memory: 83940kb
input:
749 665072 4348295 425867 5297702 1817022 5293379 6064037 1112882 5939054 7550822 597347 8629187 7972862 3895649 505584 2177975 1920494 6934302 7169927 7096607 4227605 1625492 4859537 4870812 6478145 419654 1845377 3730535 461519 3773267 1171902 7915574 491219 1047407 3549569 5302574 1179074 1611962...
output:
375
result:
ok single line: '375'
Test #30:
score: 0
Accepted
time: 74ms
memory: 82820kb
input:
749 5437390 111300 1634629 317490 2926549 328159 2929792 5910241 3623980 905910 3056119 1935499 236110 4407828 59650 4282008 2940448 3006799 792232 9055369 5506051 1947961 4672528 651472 5486101 5232799 6615738 5004121 94792 277590 5553229 1902852 2621052 1363699 4274161 1632499 1348018 835351 65018...
output:
375
result:
ok single line: '375'
Test #31:
score: 0
Accepted
time: 81ms
memory: 83824kb
input:
749 2431145 6459776 1691646 1227461 4924446 896843 1454723 7693283 3042575 1013723 632891 2451818 3461246 2292488 1216298 3770408 454698 7233503 6766025 5069888 6396173 8816816 2800316 4990811 1294391 8336783 5681543 1653126 751976 8187371 3008636 4485533 6060155 1621668 2190605 7390085 2470028 1600...
output:
375
result:
ok single line: '375'
Test #32:
score: 0
Accepted
time: 64ms
memory: 82720kb
input:
499 6106404 4182908 180377 5124722 6665789 7267164 6232975 7280886 4337586 1154399 8065214 538673 9213224 4931018 8159290 2505624 1736190 1873001 3219119 1360768 6764800 7392585 1045973 2424623 5584252 3284074 3592680 9768207 4556048 4175526 8183955 4328184 3394108 4300749 8734130 2270922 1371042 29...
output:
356
result:
ok single line: '356'
Test #33:
score: 0
Accepted
time: 71ms
memory: 83824kb
input:
499 2013917 8399426 8383957 711026 6665904 1801413 4212743 7667353 1563880 9508350 5055783 2938456 1420474 597196 7098902 4861061 1824713 8373075 9222318 2465260 2078220 3487165 170713 7552076 3664375 3857312 5104701 8178526 8064615 4021518 3548850 6425637 2588875 7883832 2063342 8254970 8405006 157...
output:
256
result:
ok single line: '256'
Test #34:
score: 0
Accepted
time: 72ms
memory: 81900kb
input:
499 8663167 4628832 3192083 216731 6220205 45354 2308163 4681181 3661493 1097231 5021346 2125421 7705421 8453634 3550235 8195599 2174748 7044552 7637568 4755972 33906 1656871 8406600 8855737 4726103 9196559 9575333 6286649 1912428 1098066 7276536 2512362 104297 8344411 1557211 3321029 3430577 164826...
output:
264
result:
ok single line: '264'
Test #35:
score: 0
Accepted
time: 60ms
memory: 82236kb
input:
499 6291510 1967953 2070815 4695581 6781427 3244170 5672219 6820026 653477 9281226 6096228 808061 6953429 5688563 449287 8766803 4588296 920053 7095246 3338527 3841745 4699728 5860056 1639937 5921129 8279748 9354978 556554 5643767 6654450 5524998 8181725 1656696 8176842 221683 4746851 1967707 361058...
output:
261
result:
ok single line: '261'
Test #36:
score: 0
Accepted
time: 74ms
memory: 82976kb
input:
749 9998146 9990307 9998050 9975346 9985120 9975271 9994030 9986437 9993283 9995293 9996691 9982027 9976183 9998917 9993430 9999876 9995410 9995520 9992776 9978871 9996466 9989881 9997021 9993541 9997987 9977236 9998580 9989346 9991387 9976936 9978331 9980641 9978190 9978076 9990286 9982483 9994843 ...
output:
375
result:
ok single line: '375'
Test #37:
score: 0
Accepted
time: 97ms
memory: 82840kb
input:
749 9999278 9999910 9993783 9999304 9999936 9999514 9996581 9999992 9999674 9997685 9997839 9999382 9995525 9999762 9999270 9999788 9999832 9999414 9999503 9999362 9994901 9996005 9999506 9997475 9999338 9997523 9999618 9995441 9996651 9999736 9999258 9999646 9999766 9997829 9999374 9999960 9999968 ...
output:
375
result:
ok single line: '375'
Test #38:
score: 0
Accepted
time: 92ms
memory: 83648kb
input:
749 9999998 9999998 9999998 9999998 9998369 9999998 9999998 9999998 9999998 9999998 9999998 9999998 9999998 9996411 9999998 9999998 9995391 9999998 9994961 9999998 9999633 9995255 9999998 9995403 9999998 9995981 9999998 9999998 9994919 9994953 9999998 9999998 9996785 9999911 9997253 9999998 9996795 ...
output:
375
result:
ok single line: '375'
Test #39:
score: 0
Accepted
time: 85ms
memory: 83640kb
input:
749 3980498 5847674 9639248 2926742 8166507 941204 2771841 5462330 813020 8949254 8875649 3622589 2415221 4642041 547967 740720 1755410 5717570 9897224 8767191 625919 5666891 8167724 4345100 1121847 4546557 7995927 3922221 7299257 2214244 570074 5048324 62741 876209 5971157 5491043 7690079 2134017 7...
output:
384
result:
ok single line: '384'
Test #40:
score: 0
Accepted
time: 96ms
memory: 83640kb
input:
749 7688801 3658961 8570504 8584619 53354 8405430 427778 5180142 3345120 353333 2966633 5969453 863507 2090766 4844483 5263181 9100853 3006506 1898046 3151436 3872714 3555032 6786804 3315558 1905452 4295681 8192585 7468628 6747899 3925859 7384574 1225298 1216806 8799719 9266129 7626947 3528335 37722...
output:
401
result:
ok single line: '401'
Test #41:
score: 0
Accepted
time: 74ms
memory: 83000kb
input:
749 2020273 5997169 3287149 7452277 8254813 2562991 901159 3943450 102700 476656 5774740 4405320 1255488 7068180 3252978 5873922 409831 8831530 4695541 9836827 3532810 5744051 9422208 6358291 5331220 1877128 2262073 8120731 7229083 6499260 1395301 3896710 4335709 7806709 9078343 4800186 1187886 9097...
output:
377
result:
ok single line: '377'
Test #42:
score: 0
Accepted
time: 69ms
memory: 82728kb
input:
749 9930867 7300598 2580096 8389343 3501501 9644652 366438 3228965 1293424 9756938 2046666 9864460 4565935 3761222 4807524 2066503 7960263 6577322 7353140 5480202 6600166 9380422 5482824 8920602 8242729 7380402 4707130 1907350 7569266 891778 8481856 3871973 4109302 5499258 9770068 2492247 2893761 64...
output:
720
result:
ok single line: '720'
Test #43:
score: -100
Wrong Answer
time: 58ms
memory: 82752kb
input:
749 3624116 9467508 5287962 5910195 4914191 8126121 2291757 8137048 1357416 4390 4888928 9967728 4608564 9864969 7866171 8609331 214537 1876128 2284423 7945136 9905448 7032084 631582 2835317 1308572 1235651 9284901 2623735 3000962 6728977 4487704 5012177 3875624 8492043 814546 7654973 3939435 897457...
output:
449
result:
wrong answer 1st lines differ - expected: '704', found: '449'