제출 #1034557

#제출 시각아이디문제언어결과실행 시간메모리
10345570pt1mus23Table Tennis (info1cup20_tabletennis)C++14
100 / 100
90 ms12292 KiB
/* I used Nelt's sol as editorial : https://oj.uz/submission/766955 */ #pragma GCC optimize("O3", "inline") #define skillissue <bits/stdc++.h> #define ultra_mal std #include skillissue using namespace ultra_mal; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); #define ins insert #define pb push_back #define int long long int #define pii pair<int, int> #define endl '\n' #define drop(x) cout<<(x)<<endl; return; #define all(x) x.begin(),x.end() #define hash FhashF const int mod = 1e9 +7, sze = 2e5 +10, inf = LLONG_MAX, P = 1453; void optimus(){ int n,k; cin>>n>>k; vector<int> arr(n); for(int i=0;i<n;i++){ cin>>arr[i]; } vector<int> kar(k); for(int i=0;i<k;i++){ cin>>kar[i]; } set<int> lst; for(int i=0;i<n/2;i++){ lst.insert(arr[i]+arr[n - i-1]); } if(lst.size()==1){ for(auto v:arr){ cout<<v<<" "; } cout<<endl; return; } vector<int> brr=arr; for(auto v:kar){ brr.pb(v); } for(int i =0;i<n+k;i++){ for(int j=i+n-1;j<n+k;j++){ int cnt=j-i+1; vector<int> ans; int l = i; int r=j; while(l<r){ if(brr[l]+brr[r]==brr[i]+brr[j]){ ans.pb(brr[l]); ans.pb(brr[r]); l++; r--; } else if(brr[l]+brr[r]>brr[i]+brr[j]){ cnt--; r--; } else{ cnt--; l++; } if(cnt<n || ans.size()>=n){ break; } } if(cnt==n){ sort(all(ans)); for(auto v:ans){ cout<<v<<" "; } cout<<endl; return; } } } } signed main() { cin.tie(0)->sync_with_stdio(0); int tt = 1; // cin>>tt; while(tt--){ optimus(); } return 0; }

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

tabletennis.cpp: In function 'void optimus()':
tabletennis.cpp:69:39: 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]
   69 |                 if(cnt<n || ans.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...