Submission #1028115

#TimeUsernameProblemLanguageResultExecution timeMemory
1028115elotelo966Table Tennis (info1cup20_tabletennis)C++17
100 / 100
235 ms6020 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define int long long #define OYY LLONG_MAX #define mod 998244353 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define FOR for(int i=1;i<=n;i++) #define mid (start+end)/2 #define lim 1000005 #define fi first #define se second int n,k; int N; int dizi[lim]; vector<int> as; inline bool cont(int l,int r){ int sum=dizi[l]+dizi[r]; vector<int> cev; while(cev.size()+r-l+1>=n && l<r && cev.size()<n){ //cout<<l<<" "<<r<<endl; while(cev.size()+r-l+1>=n && l<r && dizi[l]+dizi[r]>sum){ r--; } if(dizi[l]+dizi[r]==sum){ cev.push_back(dizi[l]); cev.push_back(dizi[r]); l++; r--; continue; } else if(dizi[l]+dizi[r]>sum){ break; } l++; } if(cev.size()==n){ as=cev; return 0; } else return 1; } int32_t main(){ faster cin>>n>>k; N=n+k; for(int i=1;i<=N;i++){ cin>>dizi[i]; } bool stop=1; for(int i=1;i<=N && stop;i++){ for(int j=i+1;j<=N && stop;j++){ //cout<<i<<" "<<j<<endl; stop=cont(i,j); //cout<<stop<<endl; } } sort(as.begin(),as.end()); for(auto x:as){ cout<<x<<" "; } cout<<'\n'; return 0; }

Compilation message (stderr)

tabletennis.cpp: In function 'bool cont(long long int, long long int)':
tabletennis.cpp:27:24: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
   27 |  while(cev.size()+r-l+1>=n && l<r && cev.size()<n){
      |        ~~~~~~~~~~~~~~~~^~~
tabletennis.cpp:27:48: 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]
   27 |  while(cev.size()+r-l+1>=n && l<r && cev.size()<n){
      |                                      ~~~~~~~~~~^~
tabletennis.cpp:29:25: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
   29 |   while(cev.size()+r-l+1>=n && l<r && dizi[l]+dizi[r]>sum){
      |         ~~~~~~~~~~~~~~~~^~~
tabletennis.cpp:45: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]
   45 |  if(cev.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...