Submission #1119732

#TimeUsernameProblemLanguageResultExecution timeMemory
1119732vjudge1Count Squares (CEOI19_countsquares)C++17
0 / 100
4083 ms336 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define int long long #define tin long long #define db double #define F first #define S second #define yes "YES" #define no "NO" using namespace std; int a[100000], N = 2e6 + 5, b[100000]; int mn = INT_MAX, mx = INT_MAX; void solve(){ int n, m, ans = 0; cin >> n >> m; vector <int> v; set <int> s; for(int i = 1; i <= n ; i++){ cin >> a[i]; } for(int i = 1 ; i <= n ; i++){ cin >> b[i]; s.insert(b[i]); } for(int i = 1; i <= n ; i ++){ for(int j = i + 1 ; j <= n ; j ++){ v.pb(abs(a[i] - a[j])); } } for(int i = 1; i <= m ; i ++){ for(int j = i + 1 ; j <= m ; j ++){ s.insert(abs(a[i] - a[j])); } } for(int i = 0; i <= v.size() - 1; i ++){ if(s.find(v[i]) != s.end()) ans++; } cout << ans; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--){ solve(); } }

Compilation message (stderr)

countsquares.cpp: In function 'void solve()':
countsquares.cpp:39:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for(int i = 0; i <= v.size() - 1; i ++){
      |                 ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...