結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-04-05 23:24:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 443 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 34,152 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 02:09:03 |
| 合計ジャッジ時間 | 866 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d %d", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <algorithm>
int main(){
int N;
scanf("%d", &N);
int L[1000], mx = 0;
for(int i=0;i<N;i++){
int a, b;
scanf("%d %d", &a, &b);
L[i] = a + 4 * b;
mx = std::max(mx, L[i]);
}
int x = L[0] & 1;
long long sum = 0;
for(int i=0;i<N;i++){
if((L[i] & 1) != x){puts("-1"); return 0;}
sum += (mx - L[i]) / 2;
}
printf("%lld\n", sum);
}
tottoripaper