제출 #675117

#제출 시각아이디문제언어결과실행 시간메모리
675117uyluluTable Tennis (info1cup20_tabletennis)C++17
72 / 100
3068 ms25216 KiB
#include <bits/stdc++.h> using namespace std; #define ld long double #define int long long #define endl "\n" const int N = 3e5,K = 400; int num[N + 1],n,k; map<int,bool> mp; vector<pair<int,int>> asd; void build(int sum,int l,int r) { mp.clear(); for(int i = l;i <= r;i++) { mp[num[i]] = 1; } for(int i = l;i <= r;i++) { if(sum < num[i]) continue; mp[num[i]] = false; if(mp[sum - num[i]]) { asd.push_back({sum - num[i],num[i]}); } } if(asd.size() < n/2 - 1) { asd.clear(); return; } vector<int> res; for(int i = 0;i < n/2 - 1;i++) { res.push_back(asd[i].first); res.push_back(asd[i].second); } sort(res.begin(),res.end()); cout<<num[l - 1]<<" "; for(auto u : res) { cout<<u<<" "; } cout<<num[r + 1]<<endl; exit(0); } signed main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); cin>>n>>k; int len = n + k; for(int i = 1;i <= len;i++) { cin>>num[i]; } for(int i = 1;i <= k + 1 && i <= len;i++) { int left = len - (k - i + 1); for(int j = left;j <= len;j++) { build(num[i] + num[j],i + 1,j - 1); } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

tabletennis.cpp: In function 'void build(long long int, long long int, long long int)':
tabletennis.cpp:28:19: 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]
   28 |     if(asd.size() < n/2 - 1) {
      |        ~~~~~~~~~~~^~~~~~~~~
#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...