Submission #1118764

#TimeUsernameProblemLanguageResultExecution timeMemory
1118764ElayV13Table Tennis (info1cup20_tabletennis)C++17
24 / 100
407 ms52732 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld double const int INF = 1e18; const int mod = 1e9 + 7; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int n , k; cin >> n >> k; vector < int > a(n + k); unordered_map < int , int > m; for(int i = 0;i < n + k;i++) { cin >> a[i]; m[a[i]]++; } vector < pair < int , int > > p; map < int , int > cnt; for(int i = 0;i < min(n + k , 5000LL) - 1;i++) { for(int j = i + 1;j < min(n + k , 1000LL);j++) { cnt[a[i] + a[j]]++; p.push_back({cnt[a[i] + a[j]],a[i] + a[j]}); } } sort(p.begin() , p.end()); int ls = p[p.size() - 1].second; vector < int > ans; for(int i = 0;i < n + k;i++) { if(ans.size() == n) break; if(m[ls - a[i]] > 0) { ans.push_back(a[i]); ans.push_back(ls - a[i]); } } sort(ans.begin() , ans.end()); for(int i : ans) cout << i << ' '; }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:38:22: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   38 |        if(ans.size() == n) break;
      |           ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...