結果
| 問題 |
No.909 たぴの配置
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2019-10-19 20:59:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 3,000 ms |
| コード長 | 983 bytes |
| コンパイル時間 | 980 ms |
| コンパイル使用メモリ | 83,256 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 20:59:03 |
| 合計ジャッジ時間 | 5,063 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:44:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
44 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:45:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
45 | for (int i = 0; i < n; i++) scanf("%d", xs + i);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:46:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
46 | for (int i = 0; i < n; i++) scanf("%d", ys + i);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 909.cc: No.909 たぴの配置 - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 200000;
const int INF = 1 << 30;
/* typedef */
/* global variables */
int xs[MAX_N], ys[MAX_N];
/* subroutines */
/* main */
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", xs + i);
for (int i = 0; i < n; i++) scanf("%d", ys + i);
int minsum = INF;
for (int i = 0; i < n; i++) {
int sum = xs[i] + ys[i];
if (minsum > sum) minsum = sum;
}
printf("%d\n0\n", minsum);
for (int i = 0; i < n; i++)
printf("%d\n", min(xs[i], minsum));
printf("%d\n", minsum);
return 0;
}
tnakao0123