結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2015-04-08 22:04:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 616 bytes |
コンパイル時間 | 642 ms |
コンパイル使用メモリ | 70,616 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 13:19:45 |
合計ジャッジ時間 | 1,369 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d%d",&a,&b); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; int main(){ int n,S[1000],a,b,maxS=0,ans=0; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d%d",&a,&b); S[i]=a+4*b; maxS=max(maxS,S[i]); } for(int i=0;i<n;i++){ if((maxS-S[i])%2){ puts("-1"); return 0; } ans+=(maxS-S[i])/2; } printf("%d\n",ans); return 0; }