# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148782 | 2019-09-01T05:06:42 Z | TLEWA맞(#3625, H_Squad, sungjune222, str0ct) | HicCup (FXCUP4_hiccup) | C++17 | 25 ms | 31872 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--; pq[c].push(0); if(C>H)return -1; 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 | 31744 KB | Output is correct |
2 | Correct | 25 ms | 31744 KB | Output is correct |
3 | Runtime error | 24 ms | 31872 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 31744 KB | Output is correct |
2 | Correct | 25 ms | 31744 KB | Output is correct |
3 | Runtime error | 24 ms | 31872 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Halted | 0 ms | 0 KB | - |