Submission #00152
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #include <iostream> #include <algorithm> #include <string> #include <map> #include <vector> using namespace std; const int MAX_N = 100010; typedef pair<string, int > P; int main(){ cin.tie(0); ios::sync_with_stdio( false ); int n; cin >> n; vector<P> vec; for ( int i = 0; i < n; ++i){ int a, b; cin >> a >> b; string str = to_string(a); int m = 0; size_t vecs = vec.size(); for ( size_t j = 0; j < vecs; ++j){ m = max(m, vec[j].second); size_t vecjs = vec[j].first.size(); bool check = true ; for ( size_t k = 0; k < min(str.size(), vecjs); ++k){ if (str[str.size() - (1 + k)] != vec[j].first[vecjs - (1 + k)]){ check = false ; break ; } } //cout << cnt << endl; if (check){ if (str.size() >= vecjs){ vec.push_back(P(str, b + vec[j].second)); } else { vec.push_back(P(vec[j].first, b + vec[j].second)); } m = max(m, b + vec[j].second); } } vec.push_back(P(str, b)); m = max(m, b); cout << m << endl; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0008 - 宝くじ |
ユーザー名 | mds_boy |
投稿日時 | 2015-08-28 11:20:55 |
言語 | C++11 |
状態 | Memory Limit Exceeded |
得点 | 0 |
ソースコード長 | 1350 Byte |
最大実行時間 | 5000 ms |
最大メモリ使用量 | 262144 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 30 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
scrambled_00.txt | AC | 20 ms | 472 KB |
1
|
scrambled_01.txt | AC | 19 ms | 688 KB |
1
|
scrambled_02.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_03.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_04.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_05.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_06.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_07.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_08.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_09.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_10.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_11.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_12.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_13.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_14.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_15.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_16.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_17.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_18.txt | MLE | 5000 ms | 262144 KB |
1
|
scrambled_19.txt | TLE | 5000 ms | 7176 KB |
1
|
scrambled_20.txt | TLE | 5000 ms | 4256 KB |
1
|
scrambled_21.txt | TLE | 5000 ms | 4916 KB |
1
|
scrambled_22.txt | TLE | 5000 ms | 5584 KB |
1
|
scrambled_23.txt | AC | 266 ms | 4028 KB |
1
|
scrambled_24.txt | AC | 1128 ms | 4816 KB |
1
|