Submission #1023732

#TimeUsernameProblemLanguageResultExecution timeMemory
1023732vjudge1Just Long Neckties (JOI20_ho_t1)C++17
9 / 100
1043 ms8576 KiB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define f first
#define s second
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
const int mod = 998244353;
void solve() {
    int n, s;
    cin >> n;
    vector <int> v(n + 1), a(n);
    for (int i = 0; i <= n; i++) {
        cin >> v[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
	vector <int> ans;
	for (int i = 0 ; i <= n; i++) {
		int mx = 0;
		vector <int> idivjopu(n);
		int k = 0;
		for (int j = 0; j < n + 1; j++) {
			if (j == i) continue;
			idivjopu[k] = v[j];
			k++;
		}
		sort(idivjopu.begin(), idivjopu.end());
		for (int j = 0; j < n; j++) {
			mx = max(idivjopu[j] - a[j], mx);
		}
		ans.pb(mx);
	}
    for (int i = 0; i <= n; i++) {
    	cout << ans[i] << " ";
	}
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}

Compilation message (stderr)

ho_t1.cpp: In function 'void solve()':
ho_t1.cpp:5:11: warning: unused variable 'second' [-Wunused-variable]
    5 | #define s second
      |           ^~~~~~
ho_t1.cpp:11:12: note: in expansion of macro 's'
   11 |     int n, s;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...