結果
問題 |
No.909 たぴの配置
|
ユーザー |
![]() |
提出日時 | 2019-10-19 03:23:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,262 bytes |
コンパイル時間 | 767 ms |
コンパイル使用メモリ | 93,316 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 03:47:17 |
合計ジャッジ時間 | 6,399 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 2 WA * 11 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:47:21: warning: ‘miny’ may be used uninitialized in this function [-Wmaybe-uninitialized] 47 | int minv=1e7,minx,miny; | ^~~~ main.cpp:47:16: warning: ‘minx’ may be used uninitialized in this function [-Wmaybe-uninitialized] 47 | int minv=1e7,minx,miny; | ^~~~
ソースコード
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<map> #include<set> #include<cstdio> #include<cmath> #include<numeric> #include<queue> #include<stack> #include<cstring> #include<limits> #include<functional> #include<unordered_set> #include<iomanip> #define rep(i,a) for(int i=(int)0;i<(int)a;++i) #define pb push_back #define eb emplace_back using ll=long long; constexpr ll mod = 1e9 + 7; constexpr ll INF = 1LL << 50; constexpr double pi=3.14159265358979; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; void solve(){ int n; cin>>n; vector<int>v(n+2),x(n),y(n); rep(i,n)cin>>x[i]; rep(i,n)cin>>y[i]; int minv=1e7,minx,miny; rep(i,n){ if(chmin(minv,x[i]+y[i])){ minx=x[i];miny=y[i]; } } v.front()=0;v.back()=minv; rep(i,n){ if(minx>miny)v[i+1]=minv-miny; else v[i+1]=minx; } cout<<minv<<"\n"; for(int z:v)cout<<z<<"\n"; return; } signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout<<fixed<<setprecision(20); solve(); return 0; }