Submission #491381

#TimeUsernameProblemLanguageResultExecution timeMemory
491381nemethmCount Squares (CEOI19_countsquares)C++17
100 / 100
2100 ms140896 KiB
#include <cstdint> #include <cstdio> #include <cstdlib> #include <iostream> #include <vector> #include <deque> #include <set> #include <map> #include <string> #include <limits> #include <assert.h> #include <cmath> #include <algorithm> using namespace std; using ll = long long int; const ll mod = 998244353; int main(){ cin.tie(0); ios_base::sync_with_stdio(false); int h, w; cin >> h >> w; vector<ll> hor(h), ver(w); for(auto& i : hor){ cin >> i; } for(auto& i : ver){ cin >> i; } map<ll, ll> m; for(int i = 0; i < h; ++i){ for(int j = i + 1; j < h; ++j){ ++m[hor[j] - hor[i]]; } } ll answ = 0; for(int i = 0; i < w; ++i){ for(int j = i + 1; j < w; ++j){ answ += m[ver[j] - ver[i]]; } } cout << answ << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...