QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#421771 | #3173. Cakey McCakeFace | juancs# | AC ✓ | 1275ms | 191244kb | C++20 | 764b | 2024-05-26 03:36:06 | 2024-05-26 03:36:07 |
Judging History
answer
#include <bits/stdc++.h>
#define el '\n'
#define forn(i, n) for(int i = 0; i < (int)n; ++i)
#define for1(i, n) for(int i = 1; i <= (int)n; ++i)
#define all(a) a.begin(), a.end()
#define d(x) cerr<<#x<<" "<<x<<el
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main(){
int n, m;
cin>>n>>m;
vi a(n), b(m);
forn(i,n)cin>>a[i];
forn(i,m)cin>>b[i];
map<int,int> cnt;
forn(i,n){
forn(j,m){
if(b[j] < a[i])continue;
++cnt[b[j] - a[i]];
}
}
int ans = 0, time = 0;
for(auto [num, frec] : cnt){
if(frec > ans){
ans = frec;
time = num;
}
}
cout<<time<<el;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3788kb
input:
5 5 0 10 12 20 30 1 5 17 27 50
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 2 50 100 0 10
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
10 10 2 4 7 11 15 17 19 26 27 28 0 13 14 19 20 25 26 27 29 30
output:
2
result:
ok single line: '2'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
100 100 0 1 2 5 9 11 12 13 15 16 17 22 25 27 30 31 32 35 37 42 43 44 48 49 51 54 61 64 68 69 71 73 75 76 81 84 86 88 89 90 92 94 95 96 97 99 100 102 103 104 106 107 108 109 111 112 114 115 116 121 122 125 126 134 137 139 140 141 144 145 146 147 149 151 152 157 159 160 161 162 163 167 168 169 173 175...
output:
17
result:
ok single line: '17'
Test #5:
score: 0
Accepted
time: 1ms
memory: 4024kb
input:
100 100 5157405 7519622 22069569 23711864 45686527 61318862 63211672 63886011 74959874 82333980 89853602 106450053 109572538 117609535 132362496 136708416 138901597 139849322 145590836 162067770 163502390 169686218 246784142 253135204 253186338 259935775 277064407 300969368 306589084 320465359 33775...
output:
29228706
result:
ok single line: '29228706'
Test #6:
score: 0
Accepted
time: 22ms
memory: 8424kb
input:
500 500 0 344 1029 1211 1852 2291 2791 2895 2915 3836 4206 4423 5308 6257 6935 7550 7962 8363 8969 9397 10266 10555 10948 10962 11385 12108 12652 12748 13551 14051 14621 15270 15482 16237 16448 16805 17002 17899 18359 18542 19305 20025 20624 21183 22153 23037 23280 23500 24046 25000 25518 26506 2686...
output:
37561
result:
ok single line: '37561'
Test #7:
score: 0
Accepted
time: 7ms
memory: 5276kb
input:
500 250 0 344 1029 1211 1852 2291 2791 2895 2915 3836 4206 4423 5308 6257 6935 7550 7962 8363 8969 9397 10266 10555 10948 10962 11385 12108 12652 12748 13551 14051 14621 15270 15482 16237 16448 16805 17002 17899 18359 18542 19305 20025 20624 21183 22153 23037 23280 23500 24046 25000 25518 26506 2686...
output:
6202
result:
ok single line: '6202'
Test #8:
score: 0
Accepted
time: 184ms
memory: 4068kb
input:
2000 2000 1 500000002 500000003 500000004 500000006 500000007 500000008 500000009 500000010 500000011 500000012 500000014 500000015 500000016 500000017 500000019 500000022 500000024 500000026 500000027 500000028 500000030 500000031 500000032 500000033 500000035 500000036 500000039 500000041 50000004...
output:
399999989
result:
ok single line: '399999989'
Test #9:
score: 0
Accepted
time: 837ms
memory: 191244kb
input:
2000 2000 13 68 143 197 220 283 325 397 400 484 536 584 620 697 723 757 845 865 949 990 1038 1085 1112 1161 1227 1289 1341 1376 1406 1459 1512 1571 1627 1657 1719 1799 1841 1896 1947 1991 2030 2085 2127 2150 2232 2250 2308 2378 2417 2459 2520 2555 2646 2682 2717 2775 2824 2858 2901 2980 3019 3064 31...
output:
100026
result:
ok single line: '100026'
Test #10:
score: 0
Accepted
time: 805ms
memory: 191044kb
input:
2000 2000 32 92 144 199 221 292 343 386 436 454 508 597 616 679 707 776 817 875 947 971 1003 1077 1102 1176 1200 1256 1310 1385 1423 1469 1517 1557 1614 1661 1706 1785 1803 1851 1923 1992 2006 2081 2141 2174 2210 2298 2303 2379 2425 2452 2502 2578 2630 2655 2706 2780 2813 2867 2917 2988 3038 3084 31...
output:
100032
result:
ok single line: '100032'
Test #11:
score: 0
Accepted
time: 1254ms
memory: 190660kb
input:
2000 2000 64 132 242 336 425 534 605 702 846 982 1062 1148 1206 1362 1478 1504 1665 1770 1887 1927 2072 2130 2213 2396 2422 2550 2675 2778 2860 2971 3074 3124 3203 3317 3412 3580 3651 3718 3883 3950 4052 4197 4298 4358 4459 4528 4662 4776 4898 4902 5055 5123 5232 5320 5419 5506 5671 5794 5836 5931 6...
output:
50420
result:
ok single line: '50420'
Test #12:
score: 0
Accepted
time: 1275ms
memory: 190796kb
input:
2000 2000 42 149 259 325 462 592 629 774 889 970 1029 1190 1223 1335 1487 1583 1622 1753 1859 1943 2082 2140 2221 2357 2473 2557 2662 2737 2891 2953 3017 3185 3203 3376 3411 3565 3668 3740 3891 3909 4063 4120 4252 4386 4408 4539 4669 4730 4844 4980 5025 5127 5220 5399 5436 5546 5656 5750 5883 5999 6...
output:
79051
result:
ok single line: '79051'
Test #13:
score: 0
Accepted
time: 944ms
memory: 95588kb
input:
2000 2000 144928 179467 307328 1216680 2866942 3044075 3831349 3849354 4395729 4488354 4658875 4990836 5152363 5378576 5969422 6325742 6446191 6915032 7349196 7736077 9093086 10176383 10270669 10398508 10462637 11562979 11691300 12156808 12693493 12789751 13005795 13732188 13749859 13915205 14002463...
output:
24633556
result:
ok single line: '24633556'
Test #14:
score: 0
Accepted
time: 943ms
memory: 94684kb
input:
2000 2000 585516 1096131 1261361 1331613 1610223 1800131 2333141 2379499 2389065 2453140 2661445 2775833 3723522 3956746 4643071 5091791 5696988 5980993 6391004 6694555 6974787 7101967 7769184 8092057 8096590 8394922 8960737 9296090 9301113 9421477 9435428 9435597 9652287 10014764 10072233 10373721 ...
output:
64733839
result:
ok single line: '64733839'
Test #15:
score: 0
Accepted
time: 114ms
memory: 4076kb
input:
2000 2000 1 10 21 24 30 31 45 46 48 49 51 61 65 68 70 77 80 89 91 93 96 104 108 115 117 121 127 129 134 135 137 139 140 151 156 157 158 163 171 172 175 177 179 186 190 192 193 194 196 203 211 212 214 220 225 236 255 263 265 266 269 281 282 298 306 307 311 314 327 331 332 333 340 341 354 360 364 369 ...
output:
92
result:
ok single line: '92'