結果
問題 | No.5008 [Cherry Alpha] Discrete Pendulum with Air Resistance |
ユーザー | FplusFplusF |
提出日時 | 2022-10-15 00:28:28 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,231 bytes |
コンパイル時間 | 1,886 ms |
実行使用メモリ | 6,956 KB |
スコア | 0 |
最終ジャッジ日時 | 2022-10-15 00:30:20 |
合計ジャッジ時間 | 110,766 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge9 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
ソースコード
#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+=2*1e7/(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+(ll)q; 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=1e9; vector<ll> ans(n,xxx); ll max_score=score(t,u,ans); mt19937 mt(rand()); while(true){ double now=clock(); if(1.9<(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); if(max_score<now_score){ max_score=now_score; }else{ ans[x]=h; } } cout << max_score << endl; rep(i,n){ cout << ans[i] << " " << ans[i] << " " << 1 << endl; } }