QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55072#2291. Lopsided LineupMIT01#AC ✓302ms11560kbC++1.1kb2022-10-12 08:43:102022-10-12 08:43:10

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-12 08:43:10]
  • 评测
  • 测评结果:AC
  • 用时:302ms
  • 内存:11560kb
  • [2022-10-12 08:43:10]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define maxn 2005
#define mod 998244353
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll ksm(ll a, ll b) {if (b == 0) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns;}
using namespace std;
int n;
int c[maxn][maxn];
int main() {
    cin >> n;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            cin >> c[i][j];
    vector<pi> cur;
    for (int i = 1; i <= n; i++) {
        int sum = 0;
        for (int j = 1; j <= n; j++)
            sum += c[i][j];
        cur.pb(mp(sum, i));
    }
    sort(cur.begin(), cur.end());
    int k = n / 2;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (i < k) ans += cur[i].fi;
        else ans -= cur[i].fi;
    }
    cout << -ans / 2<< endl;
    return 0;
}
/*
4
0 1 2 2
1 0 8 -3
2 8 0 5
2 -3 5 0
*/

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3632kb

input:

20
0 786505 911962 -800624 363821 -960995 -492637 -246590 140762 54707 -353306 -82216 -175650 567363 113374 761152 906126 -394096 -635055 675627
786505 0 801116 -323471 -34197 -860051 865281 737621 307515 -493253 -128788 -171663 -21931 853897 -505337 72985 941995 -380960 -223577 265322
911962 801116...

output:

21235600

result:

ok single line: '21235600'

Test #2:

score: 0
Accepted
time: 260ms
memory: 11396kb

input:

1000
0 605446 -182407 927547 107811 -508108 -19793 -933848 284204 -680651 -334880 480652 -316211 -229241 824306 758089 370574 331406 -896303 363352 -118936 -806685 -548261 371353 -358325 -180497 -773893 611605 -380024 42395 570930 336539 817841 -220375 -607196 -935640 -22353 -44239 -547530 -743182 1...

output:

7118983451

result:

ok single line: '7118983451'

Test #3:

score: 0
Accepted
time: 247ms
memory: 11480kb

input:

1000
0 307857 23039 -292341 -13607 -424240 -737857 -863658 158994 415442 -615982 160979 -981120 -458280 576906 -113309 294399 19111 -465395 -699372 -40470 -59097 91265 -244907 732634 -743304 42026 -296305 238571 850984 693728 647823 582244 11121 -894863 -379894 -464751 263401 724727 923694 -562862 -...

output:

7337434761

result:

ok single line: '7337434761'

Test #4:

score: 0
Accepted
time: 254ms
memory: 11468kb

input:

1000
0 154252 808218 -464053 166908 264324 461858 439444 -140013 -890113 -290507 -826454 372746 368272 387551 528861 -902250 979593 -546317 -719447 -85963 -244168 -166154 245996 43171 -5695 718942 732708 -1569 724280 -576741 -885466 412104 68151 59086 324421 -64364 -138321 243715 427700 -16083 -2169...

output:

6969510139

result:

ok single line: '6969510139'

Test #5:

score: 0
Accepted
time: 246ms
memory: 11464kb

input:

1000
0 468192 -409964 503146 940062 -569825 -838582 395994 465835 -111120 -498646 614941 -39780 688195 -865615 988854 -556184 -120871 -457733 786603 626799 311102 488481 -511144 593272 229009 -974611 347833 341620 288173 30041 -813709 34064 -732637 221050 617154 -654576 -958843 -975521 -594532 57471...

output:

7236476657

result:

ok single line: '7236476657'

Test #6:

score: 0
Accepted
time: 249ms
memory: 11476kb

input:

1000
0 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 302ms
memory: 11480kb

input:

1000
0 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000...

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 109ms
memory: 11560kb

input:

1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

2
0 1000000
1000000 0

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

2
0 -1000000
-1000000 0

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3556kb

input:

2
0 0
0 0

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

4
0 100 0 0
100 0 0 0
0 0 0 0
0 0 0 0

output:

100

result:

ok single line: '100'

Test #13:

score: 0
Accepted
time: 174ms
memory: 11476kb

input:

1000
0 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

249500000000

result:

ok single line: '249500000000'

Test #14:

score: 0
Accepted
time: 192ms
memory: 11372kb

input:

1000
0 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000...

output:

249500000000

result:

ok single line: '249500000000'

Test #15:

score: 0
Accepted
time: 234ms
memory: 11396kb

input:

1000
0 -1000000 -1000000 0 0 0 -1000000 0 -1000000 -1000000 -1000000 0 0 -1000000 0 0 0 0 -1000000 0 0 -1000000 0 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 0 0 0 0 0 -1000000 -1000000 -1000000 0 0 -1000000 0 -1000000 -1000000 0 0 0 -1000000 0 -1000000 -1000000 0 -1000000 0 0 -1000000 0 0...

output:

249500000000

result:

ok single line: '249500000000'

Test #16:

score: 0
Accepted
time: 212ms
memory: 11380kb

input:

1000
0 -10 -10 -10 -1000000 -1000000 -1000000 -10 -10 -10 -10 -10 -10 -10 -10 -10 -1000000 -1000000 -10 -1000000 -1000000 -1000000 -10 -1000000 -10 -1000000 -1000000 -1000000 -1000000 -1000000 -10 -10 -10 -10 -1000000 -10 -10 -1000000 -10 -1000000 -1000000 -10 -10 -10 -1000000 -10 -1000000 -10 -1000...

output:

485327400

result:

ok single line: '485327400'

Test #17:

score: 0
Accepted
time: 127ms
memory: 11504kb

input:

1000
0 -9 -9 -9 -9 -9 -9 9 -9 -9 9 -9 9 -9 -9 -9 -9 -9 -9 -9 9 9 9 -9 9 -9 -9 -9 9 -9 -9 -9 -9 9 9 9 9 -9 9 -9 -9 9 -9 9 9 -9 -9 9 -9 -9 9 9 -9 -9 -9 9 -9 -9 9 -9 -9 9 -9 -9 -9 9 -9 -9 -9 9 -9 -9 9 9 -9 -9 -9 -9 9 -9 -9 -9 -9 -9 -9 9 -9 -9 -9 -9 -9 -9 -9 -9 9 -9 -9 9 -9 9 -9 -9 9 9 -9 9 -9 -9 -9 -9 ...

output:

360000

result:

ok single line: '360000'

Test #18:

score: 0
Accepted
time: 131ms
memory: 11544kb

input:

1000
0 -9 -9 -9 9 9 -9 -9 -9 -9 -9 9 -9 -9 9 -9 9 9 -9 -9 9 -9 -9 9 9 -9 9 9 -9 -9 -9 -9 -9 9 9 -9 -9 -9 -9 9 9 -9 -9 -9 -9 9 -9 -9 -9 -9 9 9 9 -9 -9 -9 -9 -9 9 9 -9 -9 9 9 -9 9 -9 -9 9 -9 -9 -9 -9 -9 -9 -9 9 -9 -9 -9 -9 9 9 -9 9 -9 9 9 9 -9 -9 -9 9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 9 9 -9 9 -9 -9...

output:

360000

result:

ok single line: '360000'

Test #19:

score: 0
Accepted
time: 119ms
memory: 11388kb

input:

1000
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...

output:

499499

result:

ok single line: '499499'

Test #20:

score: 0
Accepted
time: 127ms
memory: 11476kb

input:

1000
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...

output:

2487485

result:

ok single line: '2487485'

Test #21:

score: 0
Accepted
time: 180ms
memory: 11464kb

input:

1000
0 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 100...

output:

117870

result:

ok single line: '117870'