Submission #781558

# Submission time Handle Problem Language Result Execution time Memory
781558 2023-07-13T08:00:58 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);
      |  ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -