結果
| 問題 |
No.1144 Triangles
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:44:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,564 ms / 3,000 ms |
| コード長 | 872 bytes |
| コンパイル時間 | 3,606 ms |
| コンパイル使用メモリ | 195,560 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-31 17:46:05 |
| 合計ジャッジ時間 | 24,253 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<pair<int, int>> p(n);
for (int i = 0; i < n; ++i) {
cin >> p[i].first >> p[i].second;
}
ll ans = 0;
for (int i = 0; i < n; ++i) {
ll xi = p[i].first, yi = p[i].second;
for (int j = i + 1; j < n; ++j) {
ll dxj = p[j].first - xi;
ll dyj = p[j].second - yi;
for (int k = j + 1; k < n; ++k) {
ll dxk = p[k].first - xi;
ll dyk = p[k].second - yi;
ll cross = dxj * dyk - dxk * dyj;
if (cross < 0) cross = -cross; // absolute value
ans += cross;
}
}
}
cout << ans % MOD << endl;
return 0;
}
lam6er