Submission #572523

#TimeUsernameProblemLanguageResultExecution timeMemory
572523tekiJust Long Neckties (JOI20_ho_t1)C++11
9 / 100
1053 ms6220 KiB
#include <bits/stdc++.h> typedef long long ll; #define pb push_back #define MS(x,y) memset((x),(y),sizeof((x))) #define MN 1000000007 using namespace std; int main() { #if LOCAL_DEBUG fstream cin("in.txt"); #endif ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; pair<int,int> niza[n+1]; for (int i = 0; i<n+1; i++) cin>>niza[i].first; for (int i = 0; i<n+1; i++) niza[i].second = i; int init[n]; for (int i = 0; i<n; i++) cin>>init[i]; sort(niza,niza+(n+1)); sort(init,init+n); for (int forb = 0; forb<n+1; forb++) { int res = 0,tie = 0; for (int i = 0; i<n; i++) { if (niza[tie].second == forb) tie++; res = max(res,niza[tie].first-init[i]); // cout<<niza[tie].first<<" "<<init[i]<<endl; tie++; } cout<<res<<" "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...