Submission #537595

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5375952022-03-15 09:27:38tqbfjotldSecurity Gate (JOI18_security_gate)C++14
12 / 100
5049 ms300 KiB
#include <bits/stdc++.h>
using namespace std;
bool checkbr(vector<bool> s){
int t = 0;
for (int x = 0; x<s.size(); x++){
if (s[x]) t++;
else t--;
if (t<0) return false;
}
return t==0;
}
bool valid(string s){
//printf("checking %s\n",s.c_str());
vector<int> pref;
for (int x = 0; x<s.size(); x++){
if (s[x]=='(')
pref.push_back(1);
else pref.push_back(-1);
if (pref.size()>1){
pref.back() = (*----pref.end()) + pref.back();
}
}
int cc = pref.back();
if (cc&1) return false;
if (cc==0){
vector<bool>tt;
for (int x = 0; x<s.size(); x++){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

securitygate.cpp: In function 'bool checkbr(std::vector<bool>)':
securitygate.cpp:6:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |     for (int x = 0; x<s.size(); x++){
      |                     ~^~~~~~~~~
securitygate.cpp: In function 'bool valid(std::string)':
securitygate.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int x = 0; x<s.size(); x++){
      |                     ~^~~~~~~~~
securitygate.cpp:30:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for (int x = 0; x<s.size(); x++){
      |                         ~^~~~~~~~~
securitygate.cpp:35:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int st = 0; st<s.size(); st++){
      |                      ~~^~~~~~~~~
securitygate.cpp:36:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         for (int en = st; en<s.size(); en++){
      |                           ~~^~~~~~~~~
securitygate.cpp:47:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |                 for (int x = en+1; x<s.size(); x++){
      |                                    ~^~~~~~~~~
securitygate.cpp: At global scope:
securitygate.cpp:62:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   62 |  main(){
      |  ^~~~
securitygate.cpp: In function 'int main()':
securitygate.cpp:72:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |         for (int y = 0; y<pos.size(); y++){
      |                         ~^~~~~~~~~~~
securitygate.cpp:64:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
securitygate.cpp:68:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   68 |         scanf(" %c",&str[x]);
      |         ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...