답안 #781562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
781562 2023-07-13T08:03:01 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 

#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define fio() 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 ort ((bas+son)/2)

const lo inf = 1000000000;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,a[li],k,flag,t,b[li];
int cev;
string s;
vector<int> v;

inline int in(){
	int x;
	scanf("%d",&x);
	return x;
}

int main(void){
	n=in();
	for(int i=1;i<=n+1;i++){
		b[i]=in();
	}
	FOR a[i]=in();
	sort(a+1,a+n+1);
	sort(b+1,b+n+2);
	multiset<int> st;
	for(int i=1;i<=n;i++){
		st.insert(max(0,b[i]-a[i]));
	}
	auto it=st.end();
	it--;
	v.pb(*it);
	for(int i=n;i>=1;i--){
		st.erase(st.find(max(0,b[i]-a[i])));
		st.insert(max(0,b[i+1]-a[i]));
		it=st.end();
		it--;
		v.pb(*it);
	}
	reverse(v.begin(),v.end());
	for(auto go:v)printf("%d ",go);
	//~ printf("\n");
	return 0;
}

Compilation message

ho_t1.cpp: In function 'int in()':
ho_t1.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |  scanf("%d",&x);
      |  ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -