Submission #281856

#TimeUsernameProblemLanguageResultExecution timeMemory
281856nekiCount Squares (CEOI19_countsquares)C++14
100 / 100
2375 ms141180 KiB
#include <bits/stdc++.h> #define loop(i, a, b) for(long long i=a;i<b;i++) #define pool(i, a, b) for(long long i=a-1;i>=b;i--) #define fore(i, a) for(auto&& i:a) #define ll long long using namespace std; ll a[1600], b[1600]; map<ll, ll> neki; int main(){ ll h, v;cin >> h >> v; loop(i, 0, h) cin >> a[i]; loop(i, 0, v) cin >> b[i]; loop(i, 0, h){ loop(j, 0, i){ neki[a[i]-a[j]]++; } } ll ans=0; loop(i, 0, v){ loop(j, 0, i){ ans+=neki[b[i]-b[j]]; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...