이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Count Squares
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1507;
ll a[MAXN], b[MAXN];
map<ll, ll> m;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int h, v;
    cin >> h >> v;
    for(int i = 0; i < h; i++)
        cin >> a[i];
    for(int i = 0; i < v; i++)
        cin >> b[i];
    for(int i = 0; i < h; i++)
    {
        for(int j = i+1; j < h; j++)
            m[a[j]-a[i]]++;
    }
    ll ans = 0;
    for(int i = 0; i < v; i++)
    {
        for(int j = i+1; j < v; j++)
            ans += m[b[j]-b[i]];
    }
    cout << ans << endl;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |