Submission #267194

# Submission time Handle Problem Language Result Execution time Memory
267194 2020-08-16T00:42:15 Z taulant Count Squares (CEOI19_countsquares) C++17
100 / 100
2356 ms 211384 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long 

int32_t main(){
    int h, v; cin >> h >> v;
    map<int, int> m1, m2;
    vector<int> v1(h), v2(v);
    for(int& i:v1) cin >> i;
    for(int& i:v2) cin >> i;
    for(int i=0; i<h; ++i){
        for(int j=i+1; j<h; ++j) ++m1[v1[j]-v1[i]];
    }
    for(int i=0; i<v; ++i){
        for(int j=i+1; j<v; ++j) ++m2[v2[j]-v2[i]];
    }
    int ans = 0;
    for(auto i:m1) ans += i.second * m2[i.first];
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 228 ms 34040 KB Output is correct
7 Correct 228 ms 34040 KB Output is correct
8 Correct 213 ms 34040 KB Output is correct
9 Correct 224 ms 33144 KB Output is correct
10 Correct 12 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 228 ms 34040 KB Output is correct
7 Correct 228 ms 34040 KB Output is correct
8 Correct 213 ms 34040 KB Output is correct
9 Correct 224 ms 33144 KB Output is correct
10 Correct 12 ms 1024 KB Output is correct
11 Correct 2336 ms 211384 KB Output is correct
12 Correct 2331 ms 211168 KB Output is correct
13 Correct 2077 ms 211260 KB Output is correct
14 Correct 2356 ms 208744 KB Output is correct
15 Correct 83 ms 1912 KB Output is correct