# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149355 | 2019-09-01T06:19:23 Z | TLEWA맞(#3625, H_Squad, sungjune222, str0ct) | HicCup (FXCUP4_hiccup) | C++17 | 135 ms | 76536 KB |
#include "hiccup.h" #include<bits/stdc++.h> using namespace std; vector <int> child[1010101]; int par[1010101]; priority_queue<int,vector<int>,greater<int> > pq[1001010]; int pnt; int HicCup(std::string S) { int H=0,C=0,A=0; int cnt; int N=S.size(); int c=0; 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++; child[c].push_back(++pnt); par[pnt]=c; c=pnt; } if(!flag&&S[i]=='C'){ return -1; } if(S[i]=='C'){ C++; c=par[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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 55424 KB | Output is correct |
2 | Correct | 39 ms | 55424 KB | Output is correct |
3 | Correct | 40 ms | 55424 KB | Output is correct |
4 | Correct | 43 ms | 56184 KB | Output is correct |
5 | Correct | 131 ms | 76536 KB | Output is correct |
6 | Correct | 47 ms | 58368 KB | Output is correct |
7 | Correct | 44 ms | 58432 KB | Output is correct |
8 | Correct | 124 ms | 76536 KB | Output is correct |
9 | Correct | 127 ms | 76536 KB | Output is correct |
10 | Correct | 42 ms | 58360 KB | Output is correct |
11 | Correct | 38 ms | 55416 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 55424 KB | Output is correct |
2 | Correct | 39 ms | 55424 KB | Output is correct |
3 | Correct | 40 ms | 55424 KB | Output is correct |
4 | Correct | 43 ms | 56184 KB | Output is correct |
5 | Correct | 131 ms | 76536 KB | Output is correct |
6 | Correct | 47 ms | 58368 KB | Output is correct |
7 | Correct | 44 ms | 58432 KB | Output is correct |
8 | Correct | 124 ms | 76536 KB | Output is correct |
9 | Correct | 127 ms | 76536 KB | Output is correct |
10 | Correct | 42 ms | 58360 KB | Output is correct |
11 | Correct | 56 ms | 60408 KB | Output is correct |
12 | Correct | 66 ms | 59128 KB | Output is correct |
13 | Correct | 55 ms | 58360 KB | Output is correct |
14 | Correct | 37 ms | 55424 KB | Output is correct |
15 | Correct | 44 ms | 58368 KB | Output is correct |
16 | Correct | 38 ms | 55424 KB | Output is correct |
17 | Correct | 35 ms | 55424 KB | Output is correct |
18 | Correct | 39 ms | 55680 KB | Output is correct |
19 | Correct | 106 ms | 58368 KB | Output is correct |
20 | Correct | 121 ms | 58488 KB | Output is correct |
21 | Correct | 88 ms | 58368 KB | Output is correct |
22 | Correct | 64 ms | 58232 KB | Output is correct |
23 | Correct | 64 ms | 58356 KB | Output is correct |
24 | Correct | 105 ms | 58744 KB | Output is correct |
25 | Correct | 135 ms | 68612 KB | Output is correct |
26 | Correct | 131 ms | 60280 KB | Output is correct |
27 | Correct | 81 ms | 58368 KB | Output is correct |
28 | Correct | 82 ms | 58232 KB | Output is correct |
29 | Correct | 68 ms | 58360 KB | Output is correct |
30 | Correct | 33 ms | 55424 KB | Output is correct |
31 | Correct | 41 ms | 55424 KB | Output is correct |
32 | Correct | 43 ms | 55544 KB | Output is correct |
33 | Correct | 38 ms | 55416 KB | Output is correct |