제출 #435481

#제출 시각아이디문제언어결과실행 시간메모리
435481zaneyuTable Tennis (info1cup20_tabletennis)C++14
100 / 100
141 ms3140 KiB
/*input 4 2 1 2 3 4 5 6 */ #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_sett; //order_of_key #of elements less than x // find_by_order kth element typedef long long int ll; #define ld double #define pii pair<ll,ll> #define f first #define s second #define pb push_back #define REP(i,n) for(int i=0;i<n;i++) #define REP1(i,n) for(int i=1;i<=n;i++) #define FILL(n,x) memsett(n,x,sizeof(n)) #define ALL(_a) _a.begin(),_a.end() #define sz(x) (int)x.size() const ll maxn=2e5+5; const ll maxlg=__lg(maxn)+2; const ll INF64=4e17; const int INF=0x3f3f3f3f; const ll MOD2=3006703054056749LL; const ll MOD=1e9+7; const ld PI=acos(-1); const ld eps=1e-4; #define lowb(x) x&(-x) #define MNTO(x,y) x=min(x,(__typeof__(x))y) #define MXTO(x,y) x=max(x,(__typeof__(x))y) #define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end())))) ll mult(ll a,ll b){ return ((a%MOD)*(b%MOD))%MOD; } ll mypow(ll a,ll b){ ll res=1; while(b){ if(b&1) res=mult(res,a); a=mult(a,a); b/=2; } return res; } int arr[maxn]; int ar[maxn],l[maxn],r[maxn]; int32_t main(){ ios::sync_with_stdio(false),cin.tie(0); int n,k; cin>>n>>k; REP(i,n+k) cin>>arr[i]; REP(i,k+1){ for(int j=n+k-1;j>=n+i-1;j--){ int pp=0; int s=arr[i]+arr[j]; int l=i,r=j; vector<int> ans; int bad=0; while(l<r){ int sm=arr[l]+arr[r]; if(sm==s){ ans.pb(arr[l]),ans.pb(arr[r]); ++l,--r; if(sz(ans)==n){ sort(ALL(ans)); for(auto x:ans) cout<<x<<' '; return 0; } } else if(sm<s) ++l,++bad; else --r,++bad; if(bad>k) break; } } } }

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

tabletennis.cpp: In function 'int32_t main()':
tabletennis.cpp:57:17: warning: unused variable 'pp' [-Wunused-variable]
   57 |             int pp=0;
      |                 ^~
#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...