結果

問題 No.1144 Triangles
ユーザー SSRSSSRS
提出日時 2020-07-31 21:47:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 412 ms / 3,000 ms
コード長 600 bytes
コンパイル時間 2,342 ms
コンパイル使用メモリ 182,596 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 22:47:45
合計ジャッジ時間 8,702 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 412 ms
4,380 KB
testcase_05 AC 410 ms
4,380 KB
testcase_06 AC 412 ms
4,376 KB
testcase_07 AC 411 ms
4,376 KB
testcase_08 AC 412 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 365 ms
4,376 KB
testcase_15 AC 359 ms
4,376 KB
testcase_16 AC 393 ms
4,376 KB
testcase_17 AC 394 ms
4,376 KB
testcase_18 AC 394 ms
4,380 KB
testcase_19 AC 28 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 374 ms
4,376 KB
testcase_23 AC 8 ms
4,380 KB
testcase_24 AC 368 ms
4,376 KB
testcase_25 AC 75 ms
4,380 KB
testcase_26 AC 4 ms
4,380 KB
testcase_27 AC 380 ms
4,384 KB
testcase_28 AC 41 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(){
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  for (int i = 0; i < n; i++){
    cin >> x[i] >> y[i];
  }
  long long ans = 0;
  for (int i = 0; i < n; i++){
    for (int j = i + 1; j < n; j++){
      for (int k = j + 1; k < n; k++){
        ans += abs((x[j] - x[i]) * (y[k] - y[i]) - (x[k] - x[i]) * (y[j] - y[i]));
      }
      ans %= MOD;
    }
  }
  if (ans < 0){
    ans += MOD;
  }
  cout << ans << endl;
}
0