제출 #626451

#제출 시각아이디문제언어결과실행 시간메모리
626451Abrar_Al_SamitJust Long Neckties (JOI20_ho_t1)C++17
0 / 100
0 ms212 KiB
#include<bits/stdc++.h> using namespace std; void PlayGround() { int n; cin>>n; vector<pair<int,int>>a(n+1); for(int i=0; i<n+1; i++) { cin>>a[i].first; a[i].second = i; } sort(a.begin(), a.end()); int b[n]; for(int i=0; i<n; ++i) { cin>>b[i]; } sort(b, b+n); int ans[n+1] = {0}; int pre[n+1] = {0}, suf[n+1] = {0}; for(int i=0; i<n; ++i) { int strangeness = max(0, a[i+1].first-b[i]); for(int j=0; j<=i; ++j) { ans[j] = max(ans[a[j].second], strangeness); } strangeness = max(0, a[i].first-b[i]); for(int j=i+1; j<n+1; ++j) { ans[j] = max(ans[a[j].second], strangeness); } } for(int i=0; i<n+1; ++i) { cout<<ans[i]<<' '; } cout<<'\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); PlayGround(); return 0; }

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

ho_t1.cpp: In function 'void PlayGround()':
ho_t1.cpp:20:7: warning: unused variable 'pre' [-Wunused-variable]
   20 |   int pre[n+1] = {0}, suf[n+1] = {0};
      |       ^~~
ho_t1.cpp:20:23: warning: unused variable 'suf' [-Wunused-variable]
   20 |   int pre[n+1] = {0}, suf[n+1] = {0};
      |                       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...