結果
問題 | No.5008 [Cherry Alpha] Discrete Pendulum with Air Resistance |
ユーザー | FplusFplusF |
提出日時 | 2022-10-19 02:50:40 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,960 ms / 2,000 ms |
コード長 | 2,494 bytes |
コンパイル時間 | 1,993 ms |
実行使用メモリ | 6,956 KB |
スコア | 1,397,128,335,558,394 |
最終ジャッジ日時 | 2022-10-19 02:52:36 |
合計ジャッジ時間 | 110,362 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,947 ms
3,704 KB |
testcase_01 | AC | 1,947 ms
3,764 KB |
testcase_02 | AC | 1,947 ms
3,832 KB |
testcase_03 | AC | 1,954 ms
3,832 KB |
testcase_04 | AC | 1,946 ms
3,700 KB |
testcase_05 | AC | 1,955 ms
3,780 KB |
testcase_06 | AC | 1,951 ms
3,776 KB |
testcase_07 | AC | 1,954 ms
3,772 KB |
testcase_08 | AC | 1,951 ms
3,760 KB |
testcase_09 | AC | 1,937 ms
3,708 KB |
testcase_10 | AC | 1,942 ms
3,768 KB |
testcase_11 | AC | 1,946 ms
3,708 KB |
testcase_12 | AC | 1,949 ms
3,772 KB |
testcase_13 | AC | 1,951 ms
3,708 KB |
testcase_14 | AC | 1,954 ms
6,956 KB |
testcase_15 | AC | 1,946 ms
3,780 KB |
testcase_16 | AC | 1,946 ms
3,776 KB |
testcase_17 | AC | 1,948 ms
3,832 KB |
testcase_18 | AC | 1,947 ms
3,868 KB |
testcase_19 | AC | 1,948 ms
3,708 KB |
testcase_20 | AC | 1,947 ms
3,872 KB |
testcase_21 | AC | 1,947 ms
3,768 KB |
testcase_22 | AC | 1,955 ms
3,788 KB |
testcase_23 | AC | 1,947 ms
3,764 KB |
testcase_24 | AC | 1,949 ms
4,000 KB |
testcase_25 | AC | 1,947 ms
3,708 KB |
testcase_26 | AC | 1,952 ms
3,884 KB |
testcase_27 | AC | 1,948 ms
3,880 KB |
testcase_28 | AC | 1,947 ms
3,996 KB |
testcase_29 | AC | 1,950 ms
3,708 KB |
testcase_30 | AC | 1,948 ms
3,764 KB |
testcase_31 | AC | 1,946 ms
3,800 KB |
testcase_32 | AC | 1,944 ms
3,768 KB |
testcase_33 | AC | 1,951 ms
3,776 KB |
testcase_34 | AC | 1,943 ms
3,768 KB |
testcase_35 | AC | 1,957 ms
3,700 KB |
testcase_36 | AC | 1,947 ms
3,764 KB |
testcase_37 | AC | 1,960 ms
4,000 KB |
testcase_38 | AC | 1,946 ms
3,836 KB |
testcase_39 | AC | 1,948 ms
3,764 KB |
testcase_40 | AC | 1,948 ms
3,996 KB |
testcase_41 | AC | 1,922 ms
3,776 KB |
testcase_42 | AC | 1,920 ms
3,836 KB |
testcase_43 | AC | 1,921 ms
3,776 KB |
testcase_44 | AC | 1,921 ms
3,832 KB |
testcase_45 | AC | 1,920 ms
3,776 KB |
testcase_46 | AC | 1,922 ms
3,868 KB |
testcase_47 | AC | 1,920 ms
3,780 KB |
testcase_48 | AC | 1,923 ms
3,768 KB |
testcase_49 | AC | 1,922 ms
3,764 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=7; 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=5000000000+(5000000000-0)*(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; } }