結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2015-11-06 17:08:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 549 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 62,396 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 13:04:27 |
合計ジャッジ時間 | 925 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27:13: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 27 | cout << ans <<endl; | ^~~
ソースコード
#include<iostream> #include<climits> #include<cstdlib> #include<algorithm> #include<vector> using namespace std; int main(){ int n; int ans; bool f=true; cin >> n; vector<int> x(n),y(n),d(n); for(int i=0;i<n;i++){ cin >> x[i] >> y[i]; ans = y[i]-x[i]; if(ans < 0){ cout << -1 << endl; return 0; } if(i!=0){ if(ans!=y[i-1]-x[i-1]){ cout << -1 << endl; return 0; } } } cout << ans <<endl; }