Submission #1115781

#TimeUsernameProblemLanguageResultExecution timeMemory
1115781staszic_ojuzSnake Escaping (JOI18_snake_escaping)C++17
5 / 100
2062 ms4844 KiB
#include <bits/stdc++.h> using namespace std; string bin(int n,int wielk){ string napis; while(n>0){ napis+=n%2+48; n/=2; } while(napis.size()!=wielk) napis+='0'; reverse(napis.begin(),napis.end()); return napis; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,k; string napis,kolejne_snejki; cin >> n >> k >> napis; for(int i=0;i<k;++i){ cin >> kolejne_snejki; int suma=0; for(int j=0;j<(1<<n);++j){ string cos=bin(j,n); bool jest = true; for(int p=0;p<n;++p){ if(cos[p]!=kolejne_snejki[p] && kolejne_snejki[p]!='?'){ jest=false; break; } } if(jest==true){ suma+=napis[j]-48; } } cout << suma << endl; } return 0; }

Compilation message (stderr)

snake_escaping.cpp: In function 'std::string bin(int, int)':
snake_escaping.cpp:10:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |  while(napis.size()!=wielk)
      |        ~~~~~~~~~~~~^~~~~~~
#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...