Submission #735063

#TimeUsernameProblemLanguageResultExecution timeMemory
735063NintsiChkhaidzeTable Tennis (info1cup20_tabletennis)C++17
0 / 100
736 ms21752 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define s second #define int long long using namespace std; const int N = 2e5+5,inf = 1e9; int a[N],n,k; map <int,int> mp; vector <int> v; void check(int sum){ mp.clear(); for (int i= 1; i <= n+k;i++) mp[a[i]]++; v.clear(); for (int i = 1; i <= n + k; i++){ if (!mp[a[i]]) continue; mp[a[i]]--; if (mp[sum - a[i]] > 0) { v.pb(a[i]); v.pb(sum - a[i]); mp[sum - a[i]]--; continue; } mp[a[i]]++; } if (v.size() == n){ sort(v.begin(),v.end()); for (int x: v) cout<<x<<" "; cout<<endl; exit(0); } } signed main (){ ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); cin>>n>>k; for (int i = 1; i <= n+k;i++) cin>>a[i]; for (int i = 1; i <= min(n,k/2 + 2); i++){ int c=0; for (int j = n + k; j > i; j--){ ++c; if (c > k/2 + 1) break; int s = a[i] + a[j]; check(s); } } }

Compilation message (stderr)

tabletennis.cpp: In function 'void check(long long int)':
tabletennis.cpp:30:15: 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]
   30 |  if (v.size() == n){
      |      ~~~~~~~~~^~~~
#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...