Submission #1118760

#TimeUsernameProblemLanguageResultExecution timeMemory
1118760ElayV13Table Tennis (info1cup20_tabletennis)C++17
35 / 100
1795 ms167196 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); 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 , 2000LL) - 1;i++) { for(int j = i + 1;j < min(n + k , 2000LL);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 && a[i] < ls - a[i]) { 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...