Submission #212502

#TimeUsernameProblemLanguageResultExecution timeMemory
212502DystoriaXJust Long Neckties (JOI20_ho_t1)C++14
9 / 100
1082 ms6640 KiB
#include <bits/stdc++.h> using namespace std; int n; int a[200010], b[200010]; vector<int> c; int ans[200010]; int main(){ scanf("%d", &n); for(int i = 1; i <= n + 1; i++) scanf("%d", &a[i]); for(int i = 1; i <= n; i++) scanf("%d", &b[i]); sort(b + 1, b + n + 1); for(int i = 1; i <= n + 1; i++){ c.clear(); for(int j = 1; j <= n + 1; j++){ if(i == j) continue; c.emplace_back(a[j]); } sort(c.begin(), c.end()); for(int j = 0; j < (int) c.size(); j++){ ans[i] = max(ans[i], c[j] - b[j + 1]); } } for(int i = 1; i <= n + 1; i++){ printf("%d ", ans[i]); } printf("\n"); return 0; }

Compilation message (stderr)

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
ho_t1.cpp:13:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n + 1; i++) scanf("%d", &a[i]);
                                     ~~~~~^~~~~~~~~~~~~
ho_t1.cpp:14:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; i++) scanf("%d", &b[i]);
                                 ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...