Submission #762869

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7628692023-06-21 22:00:01PanosPaskOsmosmjerka (COCI17_osmosmjerka)C++14
140 / 160
4078 ms20656 KiB
#include <bits/stdc++.h>
#define s second
#define f first
using namespace std;
typedef long long ll;
typedef __int128_t lll;
struct StringHash {
const ll MOD = (1ll << 61) - 1;
const int P = 31;
vector<ll> hash;
vector<ll> pow;
void init(string& st) {
hash.resize(st.size() + 1);
pow.resize(st.size() + 1);
hash[0] = 0;
pow[0] = 1;
for (int i = 0; i < st.size(); i++) {
hash[i + 1] = ((lll)hash[i] * P + st[i] - 'a' + 1) % MOD;
pow[i + 1] = (lll)pow[i] * P % MOD;
}
}
ll get(int l, int len) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

osmosmjerka.cpp: In member function 'void StringHash::init(std::string&)':
osmosmjerka.cpp:24:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for (int i = 0; i < st.size(); i++) {
      |                         ~~^~~~~~~~~~~
osmosmjerka.cpp: In function 'void generate_string(int, int, int, int)':
osmosmjerka.cpp:75:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   75 |     while (st.size() < cur + len - 1) {
      |            ~~~~~~~~~~^~~~~~~~~~~~~~~
osmosmjerka.cpp: In function 'int main()':
osmosmjerka.cpp:125:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  125 |             scanf(" %c", &words[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...