# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148791 | 2019-09-01T05:07:57 Z | TLEWA맞(#3625, H_Squad, sungjune222, str0ct) | HicCup (FXCUP4_hiccup) | C++17 | 81 ms | 37760 KB |
#include "hiccup.h" #include<bits/stdc++.h> using namespace std; int HicCup(std::string S) { int H=0,C=0,A=0; int cnt; int N=S.size(); int c=0; priority_queue<int,vector<int>,greater<int> > pq[1001010]; int flag=0; for(int i=0;i<N;i++){ if(!flag&&S[i]=='H')flag=1; if(S[i]=='H'&&i<N-1&&S[i+1]=='!'){ return -1; } if(S[i]=='H'){ H++; c++; } if(!flag&&S[i]=='C'){ return -1; } if(S[i]=='C'){ C++; c--; if(C>H)return -1; pq[c].push(0); cnt=0; } if(!flag&&S[i]=='!'){ return -1; } if(flag&&S[i]=='!'){ int k=pq[c].top(); pq[c].pop(); pq[c].push(k+1); cnt++; } } int ret=1010101010; if(H!=C)return -1; for(int i=0;i<N;i++){ if(!pq[i].empty()){ ret=min(pq[i].top(),ret); } } return ret;; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 31664 KB | Output is correct |
2 | Correct | 27 ms | 31744 KB | Output is correct |
3 | Correct | 25 ms | 31744 KB | Output is correct |
4 | Correct | 27 ms | 32000 KB | Output is correct |
5 | Correct | 45 ms | 37760 KB | Output is correct |
6 | Correct | 33 ms | 34688 KB | Output is correct |
7 | Correct | 32 ms | 34688 KB | Output is correct |
8 | Correct | 50 ms | 37624 KB | Output is correct |
9 | Correct | 48 ms | 37624 KB | Output is correct |
10 | Correct | 32 ms | 34688 KB | Output is correct |
11 | Correct | 24 ms | 31744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 31664 KB | Output is correct |
2 | Correct | 27 ms | 31744 KB | Output is correct |
3 | Correct | 25 ms | 31744 KB | Output is correct |
4 | Correct | 27 ms | 32000 KB | Output is correct |
5 | Correct | 45 ms | 37760 KB | Output is correct |
6 | Correct | 33 ms | 34688 KB | Output is correct |
7 | Correct | 32 ms | 34688 KB | Output is correct |
8 | Correct | 50 ms | 37624 KB | Output is correct |
9 | Correct | 48 ms | 37624 KB | Output is correct |
10 | Correct | 32 ms | 34688 KB | Output is correct |
11 | Correct | 36 ms | 35200 KB | Output is correct |
12 | Correct | 55 ms | 34936 KB | Output is correct |
13 | Correct | 33 ms | 34432 KB | Output is correct |
14 | Correct | 26 ms | 31744 KB | Output is correct |
15 | Correct | 33 ms | 34688 KB | Output is correct |
16 | Correct | 24 ms | 31664 KB | Output is correct |
17 | Correct | 24 ms | 31744 KB | Output is correct |
18 | Correct | 27 ms | 31872 KB | Output is correct |
19 | Correct | 77 ms | 34688 KB | Output is correct |
20 | Incorrect | 81 ms | 34808 KB | Output isn't correct |
21 | Halted | 0 ms | 0 KB | - |