제출 #224010

#제출 시각아이디문제언어결과실행 시간메모리
224010dwscJust Long Neckties (JOI20_ho_t1)C++14
0 / 100
4 ms256 KiB
#include <bits/stdc++.h> #define int long long using namespace std; main(){ int n; cin >> n; int arr[n+1]; for (int i = 0; i < n+1; i++) cin >> arr[i]; int arr2[n]; for (int i = 0; i < n; i++) cin >> arr2[i]; sort(arr,arr+n+1); sort(arr2,arr2+n); int ans[n+1]; ans[n] = 0; multiset<int> s; for (int i = 0; i < n; i++) s.insert(max(arr[i]-arr2[i],0LL)); ans[n] = *(--s.end()); for (int i = n-1; i >= 0; i--){ s.erase(s.find(max(arr[i]-arr2[i],0LL))); s.insert(max(arr[i+1]-arr2[i],0LL)); ans[i] = *(--s.end()); } for (int i = 0; i < n+1; i++) cout << ans[i] << " "; }

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

ho_t1.cpp:4:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...