Submission #607019

# Submission time Handle Problem Language Result Execution time Memory
607019 2022-07-26T11:18:06 Z 1bin Count Squares (CEOI19_countsquares) C++14
100 / 100
2235 ms 105736 KB
    #include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 2e3 + 5;
int n, m, a[NMAX], b[NMAX];
map<int, int> mp;

int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin >> n >> m;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < m; i++) cin >> b[i];
    for(int i = 0; i < n; i++)
        for(int j = i + 1; j < n; j++) mp[a[j] - a[i]]++;
    ll ans = 0;
    for(int i = 0; i < m; i++)
        for(int j = i + 1; j < m; j++) ans += mp[b[j] - b[i]];
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 141 ms 17164 KB Output is correct
7 Correct 158 ms 17092 KB Output is correct
8 Correct 171 ms 17084 KB Output is correct
9 Correct 163 ms 16572 KB Output is correct
10 Correct 10 ms 624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 141 ms 17164 KB Output is correct
7 Correct 158 ms 17092 KB Output is correct
8 Correct 171 ms 17084 KB Output is correct
9 Correct 163 ms 16572 KB Output is correct
10 Correct 10 ms 624 KB Output is correct
11 Correct 2235 ms 105720 KB Output is correct
12 Correct 1804 ms 105732 KB Output is correct
13 Correct 1714 ms 105736 KB Output is correct
14 Correct 1816 ms 104472 KB Output is correct
15 Correct 68 ms 1212 KB Output is correct