# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149138 | 2019-09-01T05:48:18 Z | Cafe Maru(#3599, bryan, pps789, kazel) | HicCup (FXCUP4_hiccup) | C++17 | 23 ms | 3328 KB |
#include "hiccup.h" #include<bits/stdc++.h> using namespace std; int HicCup(std::string S) { int N = S.size(); int ans = 1111111; vector<int> es, cs; es.push_back(0); cs.push_back(0); for(int i=N-1;i>=0;i--) { if (S[i] == 'H') { int e = es.back(); int c = cs.back(); es.pop_back(); cs.pop_back(); if (es.empty()) return -1; if(e > 0 && c == 0) { return -1; } else if (e == 0 && c == 0) { continue; } else if (e == 0 & c > 0) { ans = 0; } else { int t = e/c; ans = min(ans, t); } } else if (S[i] == 'C') { cs.back()++; es.push_back(0); cs.push_back(0); } else { es.back()++; } } int e = es.back(); int c = cs.back(); es.pop_back(); cs.pop_back(); if (!es.empty()) return -1; if (e == 0) ans = 0; else ans = min(ans, e/c); return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 128 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 512 KB | Output is correct |
5 | Correct | 23 ms | 3328 KB | Output is correct |
6 | Correct | 13 ms | 3328 KB | Output is correct |
7 | Correct | 12 ms | 3200 KB | Output is correct |
8 | Correct | 23 ms | 3328 KB | Output is correct |
9 | Correct | 23 ms | 3200 KB | Output is correct |
10 | Correct | 13 ms | 3328 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 128 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 512 KB | Output is correct |
5 | Correct | 23 ms | 3328 KB | Output is correct |
6 | Correct | 13 ms | 3328 KB | Output is correct |
7 | Correct | 12 ms | 3200 KB | Output is correct |
8 | Correct | 23 ms | 3328 KB | Output is correct |
9 | Correct | 23 ms | 3200 KB | Output is correct |
10 | Correct | 13 ms | 3328 KB | Output is correct |
11 | Correct | 13 ms | 3328 KB | Output is correct |
12 | Correct | 14 ms | 3328 KB | Output is correct |
13 | Correct | 16 ms | 3328 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Incorrect | 16 ms | 3200 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |