Submission #928720
Source Code Expand
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <climits> #include <iostream> #include <algorithm> #include <set> #include <map> #include <queue> #include <vector> #include <sstream> #include <typeinfo> #include <fstream> #define DIV 1000000007 #define GOO 'g' #define PA 'p' using namespace std; //go - pa, score map<int, int>dp[100005]; string S; int main(){ cin >> S; //have to choose go if(S[0] == PA){ dp[0][1] = -1; }else{ dp[0][1] = 0; } for(int i = 1; i < S.size(); i++){ if(S[i] == PA){ for(auto d: dp[i-1]){ int diff = d.first; int score = d.second; //go dp[i][diff+1] = score - 1; if(diff != 0){ //pa dp[i][diff-1] = score; } } }else{ //S[i] = GO for(auto d: dp[i-1]){ int diff = d.first; int score = d.second; //go dp[i][diff+1] = score; if(diff != 0){ //pa dp[i][diff-1] = score + 1; } } } } int ans = 0; for(auto d: dp[S.size()-1]){ ans = max(ans, d.second); } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - AtCoDeer and Rock-Paper |
User | motomuman |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1129 Byte |
Status | MLE |
Exec Time | 2139 ms |
Memory | 752128 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt |
All | 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 7 ms | 4992 KB |
0_001.txt | AC | 7 ms | 4992 KB |
1_002.txt | TLE | 2139 ms | 752128 KB |
1_003.txt | TLE | 2139 ms | 750464 KB |
1_004.txt | TLE | 2139 ms | 747904 KB |
1_005.txt | TLE | 2139 ms | 749184 KB |
1_006.txt | TLE | 2139 ms | 746368 KB |
1_007.txt | MLE | 1447 ms | 423040 KB |
1_008.txt | TLE | 2138 ms | 743168 KB |
1_009.txt | TLE | 2139 ms | 748416 KB |
1_010.txt | TLE | 2139 ms | 746240 KB |
1_011.txt | TLE | 2139 ms | 742400 KB |
1_012.txt | TLE | 2138 ms | 741632 KB |
1_013.txt | TLE | 2139 ms | 745472 KB |
1_014.txt | TLE | 2139 ms | 745216 KB |
1_015.txt | TLE | 2139 ms | 744704 KB |
1_016.txt | TLE | 2139 ms | 744320 KB |
1_017.txt | TLE | 2139 ms | 744960 KB |
1_018.txt | TLE | 2139 ms | 746240 KB |
1_019.txt | AC | 264 ms | 81664 KB |
1_020.txt | TLE | 2139 ms | 748288 KB |
1_021.txt | TLE | 2139 ms | 748544 KB |
1_022.txt | TLE | 2139 ms | 751360 KB |
1_023.txt | TLE | 2139 ms | 750336 KB |
1_024.txt | TLE | 2139 ms | 745216 KB |