# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149201 | 2019-09-01T05:56:59 Z | 샌즈뼈(#3582, exqt, esselem) | HicCup (FXCUP4_hiccup) | C++17 | 6 ms | 432 KB |
#include "hiccup.h" using namespace std; int arr[500011]={}; int sz; bool check(int k) { int i,v=0;; for (i=sz;i>=1;i--) { if (arr[i]+v<k) return 0; v+=arr[i]-k; } return 1; } int HicCup(std::string S) { int N = S.size(); int st=0,i,sum=0; for (char x:S) { if (x=='H') st++; if (x=='C') { if (!st--) return 1; sz++; } if (x=='!') { arr[sz]++; sum++;} } if (st) return -1; if (arr[0]) return -1; int l=0, r=sum/sz+1,mid; while(l+1<r) { mid=l+r>>1; if (check(mid)) l=mid; else r=mid; } return l; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 432 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 432 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |