結果
問題 | No.5008 [Cherry Alpha] Discrete Pendulum with Air Resistance |
ユーザー | FplusFplusF |
提出日時 | 2022-10-15 01:10:47 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,986 ms / 2,000 ms |
コード長 | 2,477 bytes |
コンパイル時間 | 1,912 ms |
実行使用メモリ | 6,952 KB |
スコア | 1,173,007,343,064,314 |
最終ジャッジ日時 | 2022-10-15 01:12:37 |
合計ジャッジ時間 | 109,743 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge10 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,965 ms
6,948 KB |
testcase_01 | AC | 1,943 ms
4,904 KB |
testcase_02 | AC | 1,943 ms
4,900 KB |
testcase_03 | AC | 1,941 ms
4,908 KB |
testcase_04 | AC | 1,929 ms
4,908 KB |
testcase_05 | AC | 1,967 ms
6,948 KB |
testcase_06 | AC | 1,935 ms
3,728 KB |
testcase_07 | AC | 1,942 ms
6,952 KB |
testcase_08 | AC | 1,943 ms
4,904 KB |
testcase_09 | AC | 1,941 ms
6,948 KB |
testcase_10 | AC | 1,942 ms
4,904 KB |
testcase_11 | AC | 1,944 ms
4,904 KB |
testcase_12 | AC | 1,943 ms
4,904 KB |
testcase_13 | AC | 1,965 ms
4,900 KB |
testcase_14 | AC | 1,942 ms
4,900 KB |
testcase_15 | AC | 1,943 ms
4,904 KB |
testcase_16 | AC | 1,982 ms
6,948 KB |
testcase_17 | AC | 1,959 ms
4,900 KB |
testcase_18 | AC | 1,967 ms
4,904 KB |
testcase_19 | AC | 1,963 ms
4,904 KB |
testcase_20 | AC | 1,964 ms
4,900 KB |
testcase_21 | AC | 1,965 ms
6,948 KB |
testcase_22 | AC | 1,965 ms
4,908 KB |
testcase_23 | AC | 1,964 ms
6,948 KB |
testcase_24 | AC | 1,966 ms
4,904 KB |
testcase_25 | AC | 1,981 ms
4,900 KB |
testcase_26 | AC | 1,976 ms
4,900 KB |
testcase_27 | AC | 1,986 ms
4,904 KB |
testcase_28 | AC | 1,967 ms
4,900 KB |
testcase_29 | AC | 1,965 ms
4,904 KB |
testcase_30 | AC | 1,966 ms
6,952 KB |
testcase_31 | AC | 1,984 ms
6,952 KB |
testcase_32 | AC | 1,972 ms
4,900 KB |
testcase_33 | AC | 1,961 ms
4,904 KB |
testcase_34 | AC | 1,957 ms
4,908 KB |
testcase_35 | AC | 1,964 ms
4,900 KB |
testcase_36 | AC | 1,967 ms
4,904 KB |
testcase_37 | AC | 1,966 ms
4,904 KB |
testcase_38 | AC | 1,964 ms
6,948 KB |
testcase_39 | AC | 1,966 ms
4,900 KB |
testcase_40 | AC | 1,965 ms
6,948 KB |
testcase_41 | AC | 1,964 ms
4,900 KB |
testcase_42 | AC | 1,958 ms
6,948 KB |
testcase_43 | AC | 1,963 ms
4,900 KB |
testcase_44 | AC | 1,965 ms
4,904 KB |
testcase_45 | AC | 1,968 ms
4,904 KB |
testcase_46 | AC | 1,965 ms
6,952 KB |
testcase_47 | AC | 1,967 ms
4,904 KB |
testcase_48 | AC | 1,966 ms
4,904 KB |
testcase_49 | AC | 1,966 ms
4,904 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair<ll,ll>; using tll=tuple<ll,ll,ll>; const ll INF=(1ll<<60); template<class T> void chmin(T &a,T b){ if(a>b){ a=b; } } template<class T> void chmax(T &a,T b){ if(a<b){ a=b; } } ll n,k; ll score(vector<ll> &t,vector<ll> &u,vector<ll> &ans){ double p=0; rep(i,k){ double now=0; vector<ll> x(n); rep(ii,n){ ll a=(t[i]-(ans[ii]+1))/(ans[ii]*2); ll b=(t[i]-(ans[ii]+1))%(ans[ii]*2); if(a%2==0){ x[ii]=ans[ii]-1-b; }else{ x[ii]=-ans[ii]+1+b; } } rep(ii,n-1){ for(ll jj=ii+1;jj<n;jj++){ now+=(double)abs(x[ii]-x[jj])/(double)(ans[ii]+ans[jj]); } } p+=2e7/((double)n*(n-1))*now; } double q=0; rep(i,k){ double now=0; vector<ll> x(n); rep(ii,n){ ll a=(t[i]-(ans[ii]+1))/(ans[ii]*2); ll b=(t[i]-(ans[ii]+1))%(ans[ii]*2); if(a%2==0){ x[ii]=ans[ii]-1-b; }else{ x[ii]=-ans[ii]+1+b; } } rep(ii,n-1){ for(ll jj=ii+1;jj<n;jj++){ chmax(now,(double)abs(x[ii]-x[jj])); } } q+=1e7/sqrt(now/20+1); } ll ret=(ll)(p/k)*(ll)(q/k); return ret; } int main(){ srand((unsigned int)time(NULL)); double start=clock(); cin >> n >> k; vector<ll> t(k),u(k); rep(i,k) cin >> t[i]; rep(i,k) cin >> u[i]; ll xxx=n; vector<ll> ans(n,xxx); ll max_score=score(t,u,ans); mt19937 mt(rand()); double time_limit=1.91; while(true){ double now=clock(); if(time_limit<(now-start)/CLOCKS_PER_SEC) break; ll x=mt()%n; ll h=ans[x]; ans[x]=mt()%(xxx-1)+1; ll now_score=score(t,u,ans); double now_second=now/CLOCKS_PER_SEC; double start_second=start/CLOCKS_PER_SEC; double temp=1000-900*(now_second-start_second)/time_limit; double prob=exp((now_score-max_score)/temp); if(1.0*(double)mt()/(double)(1ll<<32)<prob){ max_score=now_score; }else{ ans[x]=h; } } rep(i,n){ cout << ans[i] << " " << ans[i] << " " << 1 << endl; } }