제출 #218656

#제출 시각아이디문제언어결과실행 시간메모리
218656ryanseeJust Long Neckties (JOI20_ho_t1)C++14
0 / 100
5 ms384 KiB
#include "bits/stdc++.h" using namespace std; #define FAST ios_base::sync_with_stdio(false); cin.tie(0); #define pb push_back #define eb emplace_back #define ins insert #define f first #define s second #define cbr cerr << "hi\n" #define mmst(x, v) memset((x), v, sizeof ((x))) #define siz(x) ll(x.size()) #define all(x) (x).begin(), (x).end() #define lbd(x,y) (lower_bound(all(x),y)-x.begin()) #define ubd(x,y) (upper_bound(all(x),y)-x.begin()) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //can be used by calling rng() or shuffle(A, A+n, rng) inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); } typedef long long ll; typedef long double ld; #define FOR(i,s,e) for(ll i=s;i<=ll(e);++i) #define DEC(i,s,e) for(ll i=s;i>=ll(e);--i) typedef pair<ll,ll>pi; typedef pair<ll,pi>spi; typedef pair<pi,pi>dpi; #define LLINF ((long long)1e18) #define INF int(1e9+1e6) #define MAXN (300006) ll n,B[MAXN],ans[MAXN]; pi A[MAXN]; int main(){ FAST cin>>n; FOR(i,1,n+1)cin>>A[i].f,A[i].s=i; FOR(i,1,n)cin>>B[i]; sort(B+1,B+n+1), sort(A+1,A+n+2); ll p_mx=-LLINF; multiset<ll> ms; ms.ins(-LLINF); FOR(i,1,n)ms.ins(llabs(B[i]-A[i+1].f)); ans[A[1].s]=*--ms.end(); FOR(i,2,n+1){ ms.erase(ms.find(llabs(B[i-1]-A[i].f))); p_mx=max(p_mx,llabs(A[i-1].f-B[i-1])); ans[A[i].s]=max(p_mx,*--ms.end()); } FOR(i,1,n+1)cout<<ans[i]<<' ';cout<<'\n'; }

컴파일 시 표준 에러 (stderr) 메시지

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:22:20: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
 #define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
                    ^
ho_t1.cpp:47:2: note: in expansion of macro 'FOR'
  FOR(i,1,n+1)cout<<ans[i]<<' ';cout<<'\n';
  ^~~
ho_t1.cpp:47:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  FOR(i,1,n+1)cout<<ans[i]<<' ';cout<<'\n';
                                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...