QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#40716 | #3860. Drone Photo | Casio991ms | WA | 173ms | 30064kb | C++ | 1.1kb | 2022-07-24 18:55:49 | 2022-07-24 18:55:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define ff first
#define ss second
#define show(x) cout << #x << ": " << x << "; "
#define MOD 1000000007
#define MAXN 2000006
int pos2age[1503][1503];
pii age2pos[2250006];
int rows[1503], columns[1503];
void solve(int caseno)
{
int n, i, j, ans, youngerInRow, youngerInColumn;
cin >> n;
for(i = 1; i <= n; i++)
{
for(j = 1; j <= n; j++)
{
cin >> pos2age[i][j];
age2pos[pos2age[i][j]] = {i, j};
}
}
ans = 0;
for(i = 1; i <= n*n; i++)
{
youngerInRow = rows[age2pos[i].ff];
youngerInColumn = columns[age2pos[i].ss];
ans += youngerInRow*(n-1- youngerInColumn) + youngerInColumn*(n-1-youngerInRow);
rows[age2pos[i].ff]++;
columns[age2pos[i].ss]++;
}
cout << ans/2 << "\n";
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int T = 1, caseno = 0;
// cin >> T;
while(T--)
{
solve(++caseno);
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 5700kb
input:
2 1 3 4 2
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 3ms
memory: 5664kb
input:
2 3 2 4 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5636kb
input:
3 9 2 4 1 5 3 7 8 6
output:
6
result:
ok single line: '6'
Test #4:
score: -100
Wrong Answer
time: 173ms
memory: 30064kb
input:
1500 2248501 2248502 2248503 2248504 2248505 2248506 2248507 2248508 2248509 2248510 2248511 2248512 2248513 2248514 2248515 2248516 2248517 2248518 2248519 2248520 2248521 2248522 2248523 2248524 2248525 2248526 2248527 2248528 2248529 2248530 2248531 2248532 2248533 2248534 2248535 2248536 2248537...
output:
-929806172
result:
wrong answer 1st lines differ - expected: '1263938062500', found: '-929806172'