이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define endl '\n'
#define INF 1e9+7
#define all(x) x.begin(),x.end()
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using pii=pair<int,int>;
using ppi=pair<int,pii>;
using oset=tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename T>
void _print(vector<T> x) {for(auto e:x) cerr<<e<<",";}
template<typename T>
void _print(T x) {cerr<<x;}
void dbg() {cerr<<endl;}
template<typename Head,typename... Tail>
void dbg(Head H,Tail... T) {
_print(H);
if(sizeof...(T)) cerr<<",";
else cerr<<"\"]";
dbg(T...);
}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:[\"",dbg(__VA_ARGS__)
int n;
vector<int> a;
vector<int> b;
int solve(int x) {
vector<int> ar;
for(int i=0;i<=n;i++) {
if(i!=x) ar.push_back(a[i]);
}
sort(all(ar));
int mx=0;
for(int i=0;i<n;i++) {
int temp=max(0,ar[i]-b[i]);
mx=max(mx,temp);
}
return mx;
}
int main () {
ios::sync_with_stdio(false); cin.tie(0);
cin>>n; a.resize(n+1); b.resize(n);
for(int i=0;i<=n;i++) cin>>a[i];
for(int i=0;i<n;i++) cin>>b[i]; sort(all(b));
for(int i=0;i<=n;i++) {
cout<<solve(i)<<' ';
}
cout<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
ho_t1.cpp: In function 'int main()':
ho_t1.cpp:51:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
51 | for(int i=0;i<n;i++) cin>>b[i]; sort(all(b));
| ^~~
ho_t1.cpp:51:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
51 | for(int i=0;i<n;i++) cin>>b[i]; sort(all(b));
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |