Submission #144039

#TimeUsernameProblemLanguageResultExecution timeMemory
144039model_codeCount Squares (CEOI19_countsquares)C++17
100 / 100
2453 ms106024 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...