Submission #691841

#TimeUsernameProblemLanguageResultExecution timeMemory
691841raul2008487Table Tennis (info1cup20_tabletennis)C++17
9 / 100
3096 ms303368 KiB
#include <bits/stdc++.h> #define ll long long #define in insert #define pb push_back #define vl vector<ll> #define endl "\n" #define all(v) v.begin(),v.end() #define speed ios_base::sync_with_stdio(false);cin.tie(0); #define F first #define S second using namespace std; const int sz = 2e5+5; vl dp(sz); ll n,k,i,j,rx; void print(vl v){ for(i=0;i<v.size();i++){ cout<<v[i]<<' '; } cout<<endl; } int main(){ multimap<ll,pair<ll,ll>> mp; cin>>n>>k; vl v(n); ll im=n/2; vl ans; for(i=0;i<n;i++){ cin>>v[i]; for(j=i-1;j>=0;j--){ mp.in({v[i]+v[j],{v[i],v[j]}}); if(mp.count(v[i]+v[j])>=im){ rx=v[i]+v[j]; } } } while(im--){ auto f=mp.find(rx); ll idx1=(f->S).first; ll idx2=(f->S).second; ans.pb(idx1); ans.pb(idx2); //cout<<idx1<<" "<<idx2<<endl; mp.erase(f); } sort(all(ans)); print(ans); }

Compilation message (stderr)

tabletennis.cpp: In function 'void print(std::vector<long long int>)':
tabletennis.cpp:16:14: 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]
   16 |     for(i=0;i<v.size();i++){
      |             ~^~~~~~~~~
tabletennis.cpp: In function 'int main()':
tabletennis.cpp:31:35: warning: comparison of integer expressions of different signedness: 'std::multimap<long long int, std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   31 |             if(mp.count(v[i]+v[j])>=im){
      |                ~~~~~~~~~~~~~~~~~~~^~~~
#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...