QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#850305 | #3610. Kangaroo Party | Teapot# | AC ✓ | 1ms | 3816kb | C++20 | 1.4kb | 2025-01-09 23:39:58 | 2025-01-09 23:39:58 |
Judging History
answer
/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
vector<ll> ar(n);
FOR(i,0,n)
cin >> ar[i];
ll res = 10000000000000;
FOR(i,0,n)
FOR(j,0,n)
{
ll cur = 0;
FOR(k,0,n)
cur += min((ar[i]-ar[k])*(ar[i]-ar[k]),(ar[j]-ar[k])*(ar[j]-ar[k]));
res = min(res,cur);
}
cout << res;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3816kb
input:
5 0 3 -3 10 11
output:
19
result:
ok single line: '19'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
20 735 730 -668 -882 -607 -731 854 -992 -218 -897 591 -512 -306 314 552 -477 961 -574 -717 -106
output:
1151907
result:
ok single line: '1151907'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
17 741 -988 -613 58 79 -715 406 965 -843 373 471 588 624 992 -785 531 692
output:
1034075
result:
ok single line: '1034075'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
3 492 -681 -309
output:
138384
result:
ok single line: '138384'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
38 -865 473 174 -399 729 805 751 -710 298 -748 -906 -444 -237 366 -782 -331 -454 150 -205 53 156 -909 973 -103 22 -847 -927 374 740 -548 521 545 -881 -74 7 -691 701 -139
output:
3314504
result:
ok single line: '3314504'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
40 -407 -301 -657 -734 766 -692 -681 819 -294 715 -280 -470 -187 -926 772 -269 347 -871 191 970 501 -729 494 -980 176 874 -318 305 -494 294 -11 -37 -537 917 267 -703 65 -957 203 955
output:
3425636
result:
ok single line: '3425636'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
26 428 -257 483 832 -129 -791 -618 -480 -748 745 274 314 355 -529 -458 963 918 787 -671 404 -34 -839 -611 -120 272 -805
output:
1822321
result:
ok single line: '1822321'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
12 210 675 3 -388 -401 869 -540 -656 871 275 -877 615
output:
877576
result:
ok single line: '877576'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
48 419 521 386 839 502 807 404 -41 -144 -373 -21 647 387 465 -703 -328 -947 881 735 -670 929 -777 -669 431 661 642 -550 -538 583 389 860 -204 837 657 890 68 178 488 -293 624 -306 282 385 358 280 208 176 922
output:
3049859
result:
ok single line: '3049859'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
16 -388 194 749 -626 824 871 230 -778 -349 -885 -59 471 -963 -584 117 -649
output:
1236727
result:
ok single line: '1236727'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
15 -930 -650 375 -693 -972 88 -575 -623 393 817 -433 -805 -851 -799 -357
output:
657048
result:
ok single line: '657048'