Submission #148665

# Submission time Handle Problem Language Result Execution time Memory
148665 2019-09-01T04:53:22 Z HSNU(#3687, joylintp, 147, wiwiho) HicCup (FXCUP4_hiccup) C++17
0 / 100
6 ms 384 KB
#include<bits/stdc++.h>
#include "hiccup.h"

using namespace std;

int HicCup(string S)
{
	int N = S.size();

	stack<char> s;
	for (char c : S)
        if (s.empty())
            s.push(c);
        else if (s.top() == c)
            s.push(c);
        else
            s.pop();

	return s.empty() - 1;
}

Compilation message

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:8:6: warning: unused variable 'N' [-Wunused-variable]
  int N = S.size();
      ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -