結果
問題 |
No.3257 +|+
|
ユーザー |
![]() |
提出日時 | 2025-09-05 22:17:29 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 921 bytes |
コンパイル時間 | 6,142 ms |
コンパイル使用メモリ | 334,360 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-05 22:18:25 |
合計ジャッジ時間 | 54,708 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 TLE * 3 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000005 #define Inf64 1000000000000000001LL int main(){ int n; cin>>n; vector<long long> a(n); rep(i,n)cin>>a[i]; long long ans = 0; for(long long i=2;i<=1700;i++){ for(long long j=1;j<i;j++){ int ii = j-1,jj = (i-j)-1; if(jj>=n)continue; if(ii>=jj)break; if((a[ii]+a[jj])%i==0&&(a[ii]+a[jj])/i>300){ ans++; } } } for(long long i=1;i<=300;i++){ vector<long long> t(n); rep(j,n){ t[j] = a[j] - (j+1) * i; } sort(t.begin(),t.end()); rep(j,n){ if(t[j] < 0)continue; int d = distance(t.begin(),lower_bound(t.begin(),t.end(),-t[j])); int r = distance(t.begin(),upper_bound(t.begin(),t.end(),-t[j])); r = min(r,j); ans += r - d; } } cout<<ans<<endl; }