結果
問題 | No.2517 Right Triangles on Circle |
ユーザー |
|
提出日時 | 2023-10-27 21:25:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 428 bytes |
コンパイル時間 | 760 ms |
コンパイル使用メモリ | 78,808 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 13:26:10 |
合計ジャッジ時間 | 3,037 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include<iostream>#include<cassert>#include<algorithm>#include<cmath>#include<iomanip>using namespace std;int N,M,A[6<<17];int main(){ios::sync_with_stdio(false);cin.tie(nullptr);cin>>N>>M;for(int i=0;i<N;i++){cin>>A[i];A[i+N]=A[i]+M;}sort(A,A+N+N);long long cnt=0;int j=0;for(int i=0;i<N;i++){while(2LL*A[j]<2LL*A[i]+M)j++;if(2LL*A[j]==2LL*A[i]+M)cnt++;}cout<<cnt/2*(N-2)<<endl;}