結果
| 問題 |
No.909 たぴの配置
|
| コンテスト | |
| ユーザー |
rok_dw
|
| 提出日時 | 2020-03-21 04:47:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 387 ms / 3,000 ms |
| コード長 | 1,282 bytes |
| コンパイル時間 | 1,849 ms |
| コンパイル使用メモリ | 168,152 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-16 10:28:55 |
| 合計ジャッジ時間 | 8,514 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
int main() {
//ios::sync_with_stdio(false); cin.tie(0);
int n;
cin>>n;
vi x(n),y(n);
REP(i,n) cin>>x[i];
REP(i,n) cin>>y[i];
int mx = 0;
int mn = 10e6;
int mnidx = 0;
REP(i,n){
if(mn > x[i]+y[i]){
mn = x[i]+y[i];
mnidx = i;
}
}
cout << mn << endl;
cout << "0" << endl;
REP(i,n){
int dist = 0;
if(i==mnidx)
dist = x[i];
else if(x[i]>y[i]){
dist = max(0, mn-y[i]);
}else
dist = x[i];
cout << dist << endl;
}
cout << mn << endl;
return 0;
}
rok_dw