結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
shimashima_k
|
| 提出日時 | 2015-04-29 15:53:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 575 bytes |
| コンパイル時間 | 1,052 ms |
| コンパイル使用メモリ | 162,088 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-05 16:42:06 |
| 合計ジャッジ時間 | 1,933 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:9: warning: ‘m’ may be used uninitialized in this function [-Wmaybe-uninitialized]
8 | int m, f =-1;
| ^
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x;
int m, f =-1;
while(n--) {
int a,b,c = 0;
cin >> a>> b;
c = a+4*b;
x.push_back(c);
if (f==-1){
f = c % 2;
}else if (f != c%2) {
f = -1;
break;
}
if (m < c) m = c;
}
if (f==-1) {
cout<<-1<<endl;
return 0;
}
int ans = 0;
for (int i = 0; i < x.size(); ++i) {
ans += (m - x[i])/2;
}
cout<<ans<<endl;
return 0;
}
shimashima_k