結果
問題 | No.1447 Greedy MtSaka |
ユーザー |
![]() |
提出日時 | 2021-03-31 14:13:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 1,174 ms |
コンパイル使用メモリ | 81,096 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-14 18:54:31 |
合計ジャッジ時間 | 1,656 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include<iostream> #include<vector> #include<string> #include<sstream> #include<functional> #include<algorithm> #include<map> #include<queue> #include<stack> using namespace std; int main() { int n; cin >> n; vector<int> x(n), y(n); cin >> x[0] >> y[0]; for (int i = 1; i < n; i++) { cin >> x[i] >> y[i]; x[i] -= x[0]; y[i] -= y[0]; } int ans = 0; for (int i = 2; i < n; i++) { ans += abs(x[i] * y[i - 1] - x[i - 1] * y[i]); } cout << ans << endl; }