제출 #581197

#제출 시각아이디문제언어결과실행 시간메모리
581197chirathnirodhaJust Long Neckties (JOI20_ho_t1)C++17
100 / 100
109 ms17116 KiB
//Coded by Chirath Nirodha #include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //using namespace __gnu_pbds; using namespace std; #define F first #define S second #define PB push_back #define MP make_pair #define P push #define I insert typedef long long ll; typedef long double ld; typedef unsigned long long ull; //typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; const ll mod=1e9+7; inline void io(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } void solve(){ io(); int n;cin>>n; ll a[n+1],b[n],c[n+1]; ll arr[n],brr[n]; vector<pair<ll,ll> > v; for(int i=0;i<=n;i++){cin>>a[i];v.PB(MP(a[i],i));} for(int i=0;i<n;i++)cin>>b[i]; sort(a,a+n+1); sort(b,b+n); sort(v.begin(),v.end()); for(int i=0;i<n;i++){ arr[i]=max(a[i]-b[i],ll(0)); brr[n-1-i]=max(a[n-i]-b[n-1-i],ll(0)); if(i==0)continue; arr[i]=max(arr[i],arr[i-1]); brr[n-1-i]=max(brr[n-1-i],brr[n-i]); } c[v[0].S]=brr[0]; c[v[n].S]=arr[n-1]; for(int i=1;i<n;i++){ c[v[i].S]=max(arr[i-1],brr[i]); } for(int i=0;i<=n;i++)cout<<c[i]<<" ";cout<<endl; } int main(){ io(); solve(); //int t;cin>>t;for(int i=0;i<t;i++)solve(); return 0; }

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

ho_t1.cpp: In function 'void solve()':
ho_t1.cpp:45:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   45 |  for(int i=0;i<=n;i++)cout<<c[i]<<" ";cout<<endl;
      |  ^~~
ho_t1.cpp:45:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   45 |  for(int i=0;i<=n;i++)cout<<c[i]<<" ";cout<<endl;
      |                                       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...