結果
問題 | No.178 美しいWhitespace (1) |
ユーザー | hogeover30 |
提出日時 | 2015-04-06 01:11:49 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 54,408 KB |
最終ジャッジ日時 | 2023-09-17 05:45:30 |
合計ジャッジ時間 | 704 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:5: error: ‘vector’ was not declared in this scope vector<int> x(n); ^~~~~~ main.cpp:7:5: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? main.cpp:3:1: +#include <vector> using namespace std; main.cpp:7:5: vector<int> x(n); ^~~~~~ main.cpp:7:12: error: expected primary-expression before ‘int’ vector<int> x(n); ^~~ main.cpp:9:17: error: ‘x’ was not declared in this scope for(int& v: x) { ^ main.cpp:16:16: error: ‘x’ was not declared in this scope for(int v: x) { ^
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main() { int n; cin>>n; vector<int> x(n); int maxv=-1; for(int& v: x) { int a, b; cin>>a>>b; v=a+4*b; maxv=max(maxv, v); } auto res=0LL; for(int v: x) { int t=maxv-v; if (t%2) { res=-1; break; } res+=t/2; } cout<<res<<endl; }