結果
問題 | No.1029 JJOOII 3 |
ユーザー | queee |
提出日時 | 2020-04-17 22:21:20 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 764 bytes |
コンパイル時間 | 724 ms |
コンパイル使用メモリ | 79,108 KB |
実行使用メモリ | 14,008 KB |
最終ジャッジ日時 | 2024-04-14 14:38:12 |
合計ジャッジ時間 | 20,219 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
12,636 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 196 ms
6,948 KB |
testcase_04 | AC | 634 ms
6,940 KB |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
ソースコード
#include <iostream> #include <cmath> #include <queue> #include <cassert> using namespace std; typedef long long ll; const ll INF=1e18; int main() { int n,k; cin>>n>>k; string t; for(int i=0;i<k;i++) t+="J"; for(int i=0;i<k;i++) t+="O"; for(int i=0;i<k;i++) t+="I"; string s[n]; ll c[n]; for(int i=0;i<n;i++) { cin>>s[i]>>c[i]; } vector<ll> v(3*k+1); for(int i=0;i<=3*k;i++) v[i]=INF; v[0]=0; for(int i=0;i<3*k;i++) { for(int j=0;j<n;j++) { int u=i; for(char ch:s[j]) { if (ch == t[u]) u++; if (u == 3*k) break; } v[u] = min(v[u], v[i]+c[j]); } } /* for(int i=0;i<=3*k;i++) { cout<<v[i]<<" "; } cout<<endl;*/ if (v[3*k] == INF) cout<<"-1"<<endl; else cout<<v[3*k]<<endl; }