結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー | FplusFplusF |
提出日時 | 2023-07-16 16:06:36 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 76 ms / 2,000 ms |
コード長 | 4,359 bytes |
コンパイル時間 | 2,359 ms |
コンパイル使用メモリ | 209,604 KB |
実行使用メモリ | 24,396 KB |
スコア | 3,497,333 |
平均クエリ数 | 1000.00 |
最終ジャッジ日時 | 2023-07-16 16:06:51 |
合計ジャッジ時間 | 13,840 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 76 ms
23,628 KB |
testcase_01 | AC | 66 ms
24,372 KB |
testcase_02 | AC | 65 ms
24,336 KB |
testcase_03 | AC | 66 ms
24,384 KB |
testcase_04 | AC | 66 ms
23,412 KB |
testcase_05 | AC | 66 ms
23,436 KB |
testcase_06 | AC | 66 ms
24,336 KB |
testcase_07 | AC | 72 ms
23,544 KB |
testcase_08 | AC | 66 ms
23,844 KB |
testcase_09 | AC | 68 ms
23,436 KB |
testcase_10 | AC | 67 ms
23,628 KB |
testcase_11 | AC | 66 ms
23,640 KB |
testcase_12 | AC | 66 ms
23,424 KB |
testcase_13 | AC | 65 ms
24,036 KB |
testcase_14 | AC | 66 ms
23,856 KB |
testcase_15 | AC | 66 ms
23,640 KB |
testcase_16 | AC | 65 ms
24,012 KB |
testcase_17 | AC | 65 ms
23,424 KB |
testcase_18 | AC | 65 ms
24,036 KB |
testcase_19 | AC | 72 ms
23,436 KB |
testcase_20 | AC | 66 ms
24,036 KB |
testcase_21 | AC | 66 ms
23,676 KB |
testcase_22 | AC | 65 ms
24,360 KB |
testcase_23 | AC | 66 ms
23,412 KB |
testcase_24 | AC | 67 ms
24,372 KB |
testcase_25 | AC | 66 ms
24,384 KB |
testcase_26 | AC | 65 ms
24,336 KB |
testcase_27 | AC | 66 ms
24,336 KB |
testcase_28 | AC | 66 ms
23,532 KB |
testcase_29 | AC | 65 ms
23,424 KB |
testcase_30 | AC | 66 ms
24,036 KB |
testcase_31 | AC | 73 ms
23,424 KB |
testcase_32 | AC | 66 ms
23,844 KB |
testcase_33 | AC | 66 ms
23,532 KB |
testcase_34 | AC | 65 ms
23,844 KB |
testcase_35 | AC | 65 ms
24,024 KB |
testcase_36 | AC | 65 ms
23,412 KB |
testcase_37 | AC | 66 ms
24,036 KB |
testcase_38 | AC | 65 ms
24,372 KB |
testcase_39 | AC | 66 ms
23,652 KB |
testcase_40 | AC | 66 ms
23,388 KB |
testcase_41 | AC | 66 ms
24,360 KB |
testcase_42 | AC | 66 ms
23,844 KB |
testcase_43 | AC | 65 ms
23,388 KB |
testcase_44 | AC | 66 ms
23,652 KB |
testcase_45 | AC | 65 ms
24,024 KB |
testcase_46 | AC | 65 ms
23,976 KB |
testcase_47 | AC | 66 ms
23,544 KB |
testcase_48 | AC | 66 ms
23,388 KB |
testcase_49 | AC | 70 ms
24,012 KB |
testcase_50 | AC | 66 ms
24,024 KB |
testcase_51 | AC | 65 ms
23,844 KB |
testcase_52 | AC | 67 ms
24,036 KB |
testcase_53 | AC | 67 ms
23,976 KB |
testcase_54 | AC | 66 ms
23,652 KB |
testcase_55 | AC | 66 ms
24,276 KB |
testcase_56 | AC | 66 ms
24,060 KB |
testcase_57 | AC | 65 ms
23,664 KB |
testcase_58 | AC | 65 ms
23,436 KB |
testcase_59 | AC | 66 ms
23,652 KB |
testcase_60 | AC | 66 ms
23,412 KB |
testcase_61 | AC | 65 ms
23,640 KB |
testcase_62 | AC | 66 ms
23,844 KB |
testcase_63 | AC | 67 ms
23,844 KB |
testcase_64 | AC | 67 ms
23,664 KB |
testcase_65 | AC | 67 ms
24,060 KB |
testcase_66 | AC | 66 ms
23,640 KB |
testcase_67 | AC | 67 ms
24,348 KB |
testcase_68 | AC | 74 ms
23,532 KB |
testcase_69 | AC | 66 ms
23,532 KB |
testcase_70 | AC | 66 ms
24,396 KB |
testcase_71 | AC | 67 ms
24,036 KB |
testcase_72 | AC | 66 ms
24,036 KB |
testcase_73 | AC | 67 ms
23,640 KB |
testcase_74 | AC | 64 ms
23,532 KB |
testcase_75 | AC | 66 ms
23,436 KB |
testcase_76 | AC | 66 ms
23,436 KB |
testcase_77 | AC | 66 ms
23,400 KB |
testcase_78 | AC | 65 ms
24,036 KB |
testcase_79 | AC | 65 ms
24,012 KB |
testcase_80 | AC | 72 ms
23,388 KB |
testcase_81 | AC | 66 ms
23,832 KB |
testcase_82 | AC | 65 ms
23,856 KB |
testcase_83 | AC | 66 ms
23,640 KB |
testcase_84 | AC | 66 ms
24,264 KB |
testcase_85 | AC | 66 ms
23,844 KB |
testcase_86 | AC | 66 ms
23,640 KB |
testcase_87 | AC | 65 ms
24,372 KB |
testcase_88 | AC | 67 ms
23,676 KB |
testcase_89 | AC | 65 ms
23,388 KB |
testcase_90 | AC | 66 ms
24,384 KB |
testcase_91 | AC | 66 ms
24,324 KB |
testcase_92 | AC | 66 ms
23,388 KB |
testcase_93 | AC | 66 ms
23,412 KB |
testcase_94 | AC | 65 ms
23,664 KB |
testcase_95 | AC | 66 ms
23,532 KB |
testcase_96 | AC | 73 ms
24,072 KB |
testcase_97 | AC | 66 ms
23,388 KB |
testcase_98 | AC | 67 ms
23,628 KB |
testcase_99 | AC | 65 ms
23,436 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(); }