結果
問題 |
No.909 たぴの配置
|
ユーザー |
|
提出日時 | 2019-10-19 12:17:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 67 ms / 3,000 ms |
コード長 | 1,284 bytes |
コンパイル時間 | 970 ms |
コンパイル使用メモリ | 86,800 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 00:32:37 |
合計ジャッジ時間 | 3,853 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:49:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 49 | int n; scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:51:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 51 | REP(i, n) scanf("%d", X + i); | ~~~~~^~~~~~~~~~~~~ main.cpp:52:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 52 | REP(i, n) scanf("%d", Y + i); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream> #include <limits> #include <cfenv> #include <cmath> #include <algorithm> #include <array> #include <bitset> #include <cstring> #include <map> #include <stack> #include <set> #include <tuple> #include <queue> #include <vector> #include <cmath> #include <random> #include <math.h> #include <random> #include <functional> #define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i)) #define REP(i, n) FOR(i, 0, n) #define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i)) #define ALL(TheArray) TheArray.begin(), TheArray.end() using lli = long long int; using pii = std::pair<int, int>; template <class T> inline bool chmax(T& a, T b){ if(a < b){a = b; return true;} return false; } template <class T> inline bool chmin(T& a, T b){ if(a > b){a = b; return true;} return false; } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ constexpr int inf = 2e9; constexpr int MAX_SIZE = 2e5 + 10; int X[MAX_SIZE], Y[MAX_SIZE]; int main(void){ int n; scanf("%d", &n); int N = n + 2; REP(i, n) scanf("%d", X + i); REP(i, n) scanf("%d", Y + i); int d = inf; REP(i, n) chmin(d, X[i]+Y[i]); printf("%d\n0\n", d); REP(i, n) printf("%d\n", X[i] < d ? X[i] : d); printf("%d\n", d); return 0; }