Submission #789463

#TimeUsernameProblemLanguageResultExecution timeMemory
789463AcanikolicJust Long Neckties (JOI20_ho_t1)C++14
9 / 100
1065 ms10696 KiB
#include <bits/stdc++.h> #define ll long long #define int long long #define pb push_back #define F first #define S second using namespace std; const long long N = 2e5+10; const long long mod = 1e9+7; const long long inf = 1e18; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; vector<int>a(n+2),b(n+1); for(int i=1;i<=n+1;i++) cin >> a[i]; for(int i=1;i<=n;i++) cin >> b[i]; sort(b.begin()+1,b.end()); for(int i=1;i<=n+1;i++) { int res = 0,ptr = 1; vector<int>V; V.pb(0); for(int j=1;j<i;j++) V.pb(a[j]); for(int j=i+1;j<=n+1;j++) V.pb(a[j]); sort(V.begin()+1,V.end()); for(int j=1;j<=n;j++) res = max(res,max(0ll,V[j]-b[j])); cout << res << ' '; } return 0; }

Compilation message (stderr)

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:33:15: warning: unused variable 'ptr' [-Wunused-variable]
   33 |   int res = 0,ptr = 1;
      |               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...