Submission #1118549

#TimeUsernameProblemLanguageResultExecution timeMemory
1118549ElayV13Table Tennis (info1cup20_tabletennis)C++17
0 / 100
3104 ms491948 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld double const int INF = 1e18; const int mod = 12345; const int sz = 1e6 + 5; signed main() { ios_base::sync_with_stdio(0);cin.tie(0); int n , k; cin >> n >> k; vector < int > a(n + k); for(int i = 0;i < n + k;i++) cin >> a[i]; sort(a.begin() , a.end()); int ls = (n / 2); map < int , int > m; int pos = -1; for(int i = 0;i < n + k - 1;i++) { bool f = 0; for(int j = i + 1;j < n + k;j++) { m[a[i] + a[j]]++; if(m[a[i] + a[j]] == ls) { f = 1; pos = a[i] + a[j]; break; } } if(f) break; } vector < pair < int , int > > ans; for(int i = 0;i < n;i++) { if(ans.size() == n / 2) break; if(m[pos - a[i]] > 0) ans.push_back({a[i] , pos - a[i]}); } for(int i = 0;i < ans.size();i++) cout << ans[i].first << ' ' << ans[i].second << ' '; }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:41:21: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   41 |       if(ans.size() == n / 2) break;
      |          ~~~~~~~~~~~^~~~~~~~
tabletennis.cpp:44:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |    for(int i = 0;i < ans.size();i++) cout << ans[i].first << ' ' << ans[i].second << ' ';
      |                  ~~^~~~~~~~~~~~
#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...