結果

問題 No.1144 Triangles
コンテスト
ユーザー 沙耶花
提出日時 2020-07-31 23:10:52
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1,865 ms / 3,000 ms
コード長 513 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,471 ms
コンパイル使用メモリ 202,872 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-11 22:31:16
合計ジャッジ時間 26,223 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:14:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         for(int i=0;i<n;i++)scanf("%d %d",&x[i],&y[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000002


int main(){

	int n;
	scanf("%d",&n);
	
	vector<int> x(n),y(n);
	for(int i=0;i<n;i++)scanf("%d %d",&x[i],&y[i]);
	
	int 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[i]-x[j])*(y[i]-y[k]) - (x[i]-x[k]) * (y[i]-y[j]));
				if(ans>=modulo)ans-=modulo;
			}
		}
	}
	
	cout<<ans<<endl;

	return 0;
}
0