結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー | FplusFplusF |
提出日時 | 2023-07-16 16:26:44 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 66 ms / 2,000 ms |
コード長 | 4,363 bytes |
コンパイル時間 | 2,217 ms |
コンパイル使用メモリ | 208,936 KB |
実行使用メモリ | 24,396 KB |
スコア | 1,424,997 |
平均クエリ数 | 655.34 |
最終ジャッジ日時 | 2023-07-16 16:27:48 |
合計ジャッジ時間 | 11,984 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 62 ms
23,544 KB |
testcase_01 | AC | 63 ms
23,664 KB |
testcase_02 | AC | 63 ms
23,544 KB |
testcase_03 | AC | 65 ms
23,652 KB |
testcase_04 | AC | 63 ms
24,372 KB |
testcase_05 | AC | 42 ms
23,628 KB |
testcase_06 | AC | 47 ms
23,544 KB |
testcase_07 | AC | 39 ms
23,664 KB |
testcase_08 | AC | 42 ms
24,288 KB |
testcase_09 | AC | 30 ms
23,676 KB |
testcase_10 | AC | 50 ms
23,544 KB |
testcase_11 | AC | 38 ms
23,844 KB |
testcase_12 | AC | 44 ms
24,072 KB |
testcase_13 | AC | 43 ms
23,376 KB |
testcase_14 | AC | 66 ms
24,012 KB |
testcase_15 | AC | 47 ms
23,652 KB |
testcase_16 | AC | 64 ms
23,844 KB |
testcase_17 | AC | 36 ms
24,288 KB |
testcase_18 | AC | 44 ms
23,424 KB |
testcase_19 | AC | 32 ms
24,276 KB |
testcase_20 | AC | 64 ms
24,048 KB |
testcase_21 | AC | 50 ms
23,388 KB |
testcase_22 | AC | 64 ms
23,412 KB |
testcase_23 | AC | 64 ms
24,336 KB |
testcase_24 | AC | 52 ms
23,424 KB |
testcase_25 | AC | 49 ms
23,640 KB |
testcase_26 | AC | 64 ms
23,844 KB |
testcase_27 | AC | 44 ms
24,360 KB |
testcase_28 | AC | 65 ms
24,264 KB |
testcase_29 | AC | 63 ms
24,336 KB |
testcase_30 | AC | 59 ms
23,856 KB |
testcase_31 | AC | 63 ms
23,424 KB |
testcase_32 | AC | 47 ms
23,388 KB |
testcase_33 | AC | 53 ms
23,820 KB |
testcase_34 | AC | 58 ms
24,348 KB |
testcase_35 | AC | 50 ms
23,424 KB |
testcase_36 | AC | 46 ms
24,360 KB |
testcase_37 | AC | 52 ms
23,436 KB |
testcase_38 | AC | 36 ms
24,036 KB |
testcase_39 | AC | 46 ms
23,532 KB |
testcase_40 | AC | 64 ms
24,276 KB |
testcase_41 | AC | 64 ms
23,640 KB |
testcase_42 | AC | 37 ms
24,336 KB |
testcase_43 | AC | 64 ms
23,424 KB |
testcase_44 | AC | 65 ms
23,844 KB |
testcase_45 | AC | 64 ms
23,532 KB |
testcase_46 | AC | 35 ms
24,072 KB |
testcase_47 | AC | 31 ms
23,844 KB |
testcase_48 | AC | 36 ms
24,060 KB |
testcase_49 | AC | 55 ms
23,844 KB |
testcase_50 | AC | 28 ms
23,652 KB |
testcase_51 | AC | 48 ms
24,276 KB |
testcase_52 | AC | 65 ms
24,060 KB |
testcase_53 | AC | 55 ms
23,844 KB |
testcase_54 | AC | 34 ms
23,424 KB |
testcase_55 | AC | 63 ms
24,048 KB |
testcase_56 | AC | 31 ms
24,048 KB |
testcase_57 | AC | 31 ms
23,388 KB |
testcase_58 | AC | 32 ms
23,388 KB |
testcase_59 | AC | 65 ms
24,048 KB |
testcase_60 | AC | 30 ms
23,664 KB |
testcase_61 | AC | 33 ms
23,640 KB |
testcase_62 | AC | 50 ms
24,024 KB |
testcase_63 | AC | 61 ms
24,036 KB |
testcase_64 | AC | 38 ms
23,640 KB |
testcase_65 | AC | 43 ms
23,424 KB |
testcase_66 | AC | 61 ms
23,376 KB |
testcase_67 | AC | 52 ms
23,544 KB |
testcase_68 | AC | 29 ms
23,532 KB |
testcase_69 | AC | 52 ms
23,844 KB |
testcase_70 | AC | 65 ms
23,388 KB |
testcase_71 | AC | 62 ms
24,252 KB |
testcase_72 | AC | 60 ms
24,264 KB |
testcase_73 | AC | 65 ms
23,640 KB |
testcase_74 | AC | 50 ms
23,388 KB |
testcase_75 | AC | 65 ms
23,556 KB |
testcase_76 | AC | 65 ms
24,024 KB |
testcase_77 | AC | 43 ms
24,036 KB |
testcase_78 | AC | 42 ms
24,048 KB |
testcase_79 | AC | 63 ms
23,628 KB |
testcase_80 | AC | 35 ms
24,396 KB |
testcase_81 | AC | 31 ms
23,424 KB |
testcase_82 | AC | 61 ms
24,024 KB |
testcase_83 | AC | 31 ms
23,400 KB |
testcase_84 | AC | 53 ms
23,856 KB |
testcase_85 | AC | 55 ms
23,640 KB |
testcase_86 | AC | 56 ms
24,276 KB |
testcase_87 | AC | 28 ms
24,036 KB |
testcase_88 | AC | 39 ms
23,652 KB |
testcase_89 | AC | 49 ms
23,556 KB |
testcase_90 | AC | 51 ms
23,544 KB |
testcase_91 | AC | 32 ms
23,856 KB |
testcase_92 | AC | 60 ms
23,388 KB |
testcase_93 | AC | 51 ms
24,348 KB |
testcase_94 | AC | 55 ms
24,036 KB |
testcase_95 | AC | 50 ms
23,400 KB |
testcase_96 | AC | 59 ms
24,288 KB |
testcase_97 | AC | 60 ms
23,628 KB |
testcase_98 | AC | 65 ms
24,036 KB |
testcase_99 | AC | 58 ms
23,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; const int INF=1e9; using pii=pair<int,int>; using tii=tuple<int,int,int>; #define rep(i,n) for (int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() 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; } } int H=60,W=25; struct Input{ int n; vector<int> h,p,x; void input_cin(){ cin >> n; if(n==-1) exit(0); h.assign(n,0); p.assign(n,0); x.assign(n,0); rep(i,n) cin >> h[i] >> p[i] >> x[i]; } }Input; struct solver{ struct shooter{ int j; int l; int s; }; struct enemy{ int fh; int h; int p; }; void solve(){ int score=0; shooter me={12,1,0}; vector<vector<enemy>> grid(H,vector<enemy>(W,{0,0,0})); int to=-1; rep(t,1000){ for(int i=H-2;0<=i;i--){ rep(j,W){ grid[i+1][j]=grid[i][j]; grid[i][j]={0,0,0}; } } Input.input_cin(); rep(i,Input.n){ grid[0][Input.x[i]].fh=Input.h[i]; grid[0][Input.x[i]].h=Input.h[i]; grid[0][Input.x[i]].p=Input.p[i]; } if(1<=me.l){ if(to==-1){ double mx=0; int p=-1; rep(i,H){ rep(j,W){ if(0<grid[i][j].h){ if(grid[i][j].h-(H-1-i-abs(me.j-j))*me.l<=0){ bool ok=true; for(int k=1;k<abs(me.j-j);k++){ if(me.j<j){ if(0<grid[H-1-k][me.j+k].h) ok=false; //if(0<grid[H-1-k+1][me.j+k].h) ok=false; }else{ if(0<grid[H-1-k][me.j-k].h) ok=false; //if(0<grid[H-1-k+1][me.j-k].h) ok=false; } } for(int k=i+1;k<H;k++){ if(0<grid[k][j].h) ok=false; } if(!ok) continue; double now=(double)grid[i][j].fh/(double)(abs(me.j-j)+(grid[i][j].h+me.l-1)/me.l); if(mx<now){ mx=now; p=j; } } } } } to=p; } if(to==-1){ cout << "S" << endl; }else if(to<me.j){ cout << "L" << endl; me.j--; }else if(me.j<to){ cout << "R" << endl; me.j++; }else{ cout << "S" << endl; } }else if(0<grid[H-2][me.j].h){ if(0<=me.j-1&&grid[H-2][me.j-1].h==0){ cout << "L" << endl; me.j--; }else if(me.j+1<W&&grid[H-2][me.j+1].h==0){ cout << "R" << endl; me.j++; }else{ cout << "S" << endl; } }else{ cout << "S" << endl; } for(int i=H-2;0<=i;i--){ if(0<grid[i][me.j].h){ grid[i][me.j].h-=me.l; if(grid[i][me.j].h<=0){ score+=grid[i][me.j].fh; grid[i][me.j].fh=0; grid[i][me.j].h=0; me.s+=grid[i][me.j].p; grid[i][me.j].p=0; if(me.j==to) to=-1; } break; } } me.l=1+me.s/100; } } }Solver; int main(){ Solver.solve(); }