Submission #144039

# Submission time Handle Problem Language Result Execution time Memory
144039 2019-08-15T18:50:03 Z model_code Count Squares (CEOI19_countsquares) C++17
100 / 100
2453 ms 106024 KB
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
    int H, V;
    cin >> H >> V;
    vector<int> A(H), B(V);
    for (int i=0; i<H; ++i) cin >> A[i];
    for (int i=0; i<V; ++i) cin >> B[i];
    map<int,int> cnt;
    for (int i=0; i<H; ++i) for (int j=0; j<i; ++j) cnt[ A[i]-A[j] ]++;
    long long res = 0;
    for (int i=0; i<V; ++i) for (int j=0; j<i; ++j) res += cnt[ B[i]-B[j] ];
    cout << res << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 227 ms 17272 KB Output is correct
7 Correct 226 ms 17144 KB Output is correct
8 Correct 224 ms 17144 KB Output is correct
9 Correct 316 ms 16676 KB Output is correct
10 Correct 23 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 227 ms 17272 KB Output is correct
7 Correct 226 ms 17144 KB Output is correct
8 Correct 224 ms 17144 KB Output is correct
9 Correct 316 ms 16676 KB Output is correct
10 Correct 23 ms 636 KB Output is correct
11 Correct 2453 ms 106024 KB Output is correct
12 Correct 2453 ms 105824 KB Output is correct
13 Correct 2317 ms 105948 KB Output is correct
14 Correct 2350 ms 104460 KB Output is correct
15 Correct 181 ms 1144 KB Output is correct