結果

問題 No.1144 Triangles
ユーザー sakaki_tohrusakaki_tohru
提出日時 2020-08-17 07:49:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 578 ms / 3,000 ms
コード長 675 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 81,300 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 18:39:52
合計ジャッジ時間 8,909 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 557 ms
5,376 KB
testcase_05 AC 558 ms
5,376 KB
testcase_06 AC 556 ms
5,376 KB
testcase_07 AC 552 ms
5,376 KB
testcase_08 AC 578 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 490 ms
5,376 KB
testcase_15 AC 483 ms
5,376 KB
testcase_16 AC 536 ms
5,376 KB
testcase_17 AC 533 ms
5,376 KB
testcase_18 AC 519 ms
5,376 KB
testcase_19 AC 36 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 497 ms
5,376 KB
testcase_23 AC 10 ms
5,376 KB
testcase_24 AC 481 ms
5,376 KB
testcase_25 AC 99 ms
5,376 KB
testcase_26 AC 5 ms
5,376 KB
testcase_27 AC 497 ms
5,376 KB
testcase_28 AC 52 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <utility>
using namespace std;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
constexpr unsigned int MOD=1000000007;
int main(){
    int n;cin>>n;
    vector<pair<int,int>> p(n);

    for(int i=0;i<n;i++){
        cin>>p[i].first>>p[i].second;
    }
    unsigned 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((p[i].first-p[k].first)*(p[j].second-p[k].second)-(p[j].first-p[k].first)*(p[i].second-p[k].second));
            }
        }
    }

    ans%=MOD;
    cout<<ans<<endl;

    return 0;
}
0