Submission #1118538

#TimeUsernameProblemLanguageResultExecution timeMemory
1118538ElayV13Table Tennis (info1cup20_tabletennis)C++17
20 / 100
85 ms17744 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()); vector < int > q1; vector < int > q2; for(int i = 1;i < n + k;i++) q1.push_back(a[i]); for(int i = 0;i < n + k - 1;i++) q2.push_back(a[i]); set < int > s1; for(int i = 0;i < q1.size() / 2;i++) { s1.insert(q1[i] + q1[q1.size() - i - 1]); } if(s1.size() == 1) { for(int i : q1) cout << i << ' '; return 0; } s1.clear(); for(int i = 0;i < q2.size() / 2;i++) { s1.insert(q2[i] + q2[q2.size() - i - 1]); } if(s1.size() == 1) { for(int i : q2) cout << i << ' '; return 0; } int ls = a[0] + a[n + k - 1]; map < int , int > cnt; for(int i = 0;i < n + k;i++) cnt[a[i]]++; int in = -1; for(int i = 0;i < n + k;i++) { if(!cnt[ls - a[i]]) { in = i; break; } } vector < int > l; for(int i = 0;i < n + k;i++) { if(i == in) continue; l.push_back(a[i]); } for(int i : l){ cout << i << ' '; } cout << endl; }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:28:20: 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]
   28 |    for(int i = 0;i < q1.size() / 2;i++)
      |                  ~~^~~~~~~~~~~~~~~
tabletennis.cpp:38:20: 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]
   38 |    for(int i = 0;i < q2.size() / 2;i++)
      |                  ~~^~~~~~~~~~~~~~~
#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...