Submission #422794

# Submission time Handle Problem Language Result Execution time Memory
422794 2021-06-10T12:30:49 Z Garguy22 Count Squares (CEOI19_countsquares) C++17
100 / 100
2625 ms 140860 KB
//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
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 208 ms 22792 KB Output is correct
7 Correct 197 ms 22712 KB Output is correct
8 Correct 193 ms 22724 KB Output is correct
9 Correct 191 ms 22080 KB Output is correct
10 Correct 14 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 208 ms 22792 KB Output is correct
7 Correct 197 ms 22712 KB Output is correct
8 Correct 193 ms 22724 KB Output is correct
9 Correct 191 ms 22080 KB Output is correct
10 Correct 14 ms 852 KB Output is correct
11 Correct 2609 ms 140860 KB Output is correct
12 Correct 2625 ms 140844 KB Output is correct
13 Correct 2510 ms 140840 KB Output is correct
14 Correct 2522 ms 139056 KB Output is correct
15 Correct 89 ms 1384 KB Output is correct