| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 581197 | chirathnirodha | Just Long Neckties (JOI20_ho_t1) | C++17 | 109 ms | 17116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Coded by Chirath Nirodha
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define P push
#define I insert
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const ll mod=1e9+7;
inline void io(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
void solve(){
io();
int n;cin>>n;
ll a[n+1],b[n],c[n+1];
ll arr[n],brr[n];
vector<pair<ll,ll> > v;
for(int i=0;i<=n;i++){cin>>a[i];v.PB(MP(a[i],i));}
for(int i=0;i<n;i++)cin>>b[i];
sort(a,a+n+1);
sort(b,b+n);
sort(v.begin(),v.end());
for(int i=0;i<n;i++){
arr[i]=max(a[i]-b[i],ll(0));
brr[n-1-i]=max(a[n-i]-b[n-1-i],ll(0));
if(i==0)continue;
arr[i]=max(arr[i],arr[i-1]);
brr[n-1-i]=max(brr[n-1-i],brr[n-i]);
}
c[v[0].S]=brr[0];
c[v[n].S]=arr[n-1];
for(int i=1;i<n;i++){
c[v[i].S]=max(arr[i-1],brr[i]);
}
for(int i=0;i<=n;i++)cout<<c[i]<<" ";cout<<endl;
}
int main(){
io();
solve();
//int t;cin>>t;for(int i=0;i<t;i++)solve();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
