QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#55071 | #2291. Lopsided Lineup | MIT01# | WA | 250ms | 11396kb | C++ | 1.1kb | 2022-10-12 08:42:40 | 2022-10-12 08:42:43 |
Judging History
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;
int 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: 3ms
memory: 3612kb
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: -100
Wrong Answer
time: 250ms
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:
676532507
result:
wrong answer 1st lines differ - expected: '7118983451', found: '676532507'