結果
問題 | No.909 たぴの配置 |
ユーザー | ate |
提出日時 | 2019-10-18 21:45:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 282 ms / 3,000 ms |
コード長 | 1,301 bytes |
コンパイル時間 | 1,806 ms |
コンパイル使用メモリ | 195,112 KB |
最終ジャッジ日時 | 2025-01-07 22:47:37 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
コンパイルメッセージ
main.cpp:18:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 18 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0;i<(n);++i) #define reps(i,n) for(ll i=1;i<=(n);++i) using ll = long long; using str = string; constexpr long long INF = (1LL<<60); constexpr long long MOD = (1e9+7); template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} inline void dump(){cout<<endl;} template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);} template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;} template<class T>vector<T> make_vector(size_t a){return vector<T>(a);} template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));} main(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(10); ll n; cin>>n; vector<ll> x(n),y(n); cin>>x>>y; ll ans=INF; rep(i,n){ chmin(ans,abs(x[i]+y[i])); } cout<<(ans)<<endl; cout<<0<<endl; rep(i,n){ if(x[i]<abs(ans-y[i])){ cout<<x[i]<<endl; }else{ cout<<abs(ans-y[i])<<endl; } } cout<<(ans)<<endl; }