Submission #629169

#TimeUsernameProblemLanguageResultExecution timeMemory
629169iomoon191Just Long Neckties (JOI20_ho_t1)C++17
100 / 100
106 ms15476 KiB
#include<bits/stdc++.h> #define int long long #define all(a) a.begin(), a.end() #define sz(a) (int)(a).size() #define pb push_back #define fi first #define se second #define For(i,a,b) for(int i=(a); i<=(b); ++i) #define roF(i,a,b) for(int i=(a); i>=(b); --i) using namespace std; #ifdef DEBUG__ void dmpr(ostream &os){ os << "\n"; } template<class T, class... Args> void dmpr(ostream &os, const T &t, const Args &... args){ os << t << " "; dmpr(os, args...); } #define dbg(...) dmpr(cerr, __LINE__, ##__VA_ARGS__) #else #define dbg(...) void(0) #endif typedef vector<int> vi; typedef pair<int, int> pi; typedef long long ll; typedef long double ld; const int N=200005; const int inf=0x3f3f3f3f; mt19937 rng(random_device {}()); int rand(int a){ return rng()%a; } int n, b[N], pref[N], suf[N], res[N]; pi a[N]; void rmain(){ cin >> n; For(i,1,n+1){ cin >> a[i].fi; a[i].se=i; } For(i,1,n) cin >> b[i]; sort(a+1, a+n+2); sort(b+1, b+n+1); For(i,1,n) pref[i]=max(pref[i-1], a[i].fi-b[i]); roF(i,n,1) suf[i]=max(suf[i+1], a[i+1].fi-b[i]); For(i,1,n+1) res[a[i].se]=max(pref[i-1], suf[i]); For(i,1,n+1) cout << res[i] << " "; } signed main(int argc, char *argv[]){ iostream::sync_with_stdio(0); int T=1; while(T--) rmain(); return 0; }

Compilation message (stderr)

ho_t1.cpp:47:8: warning: first argument of 'int main(long long int, char**)' should be 'int' [-Wmain]
   47 | signed main(int argc, char *argv[]){
      |        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...