Submission #1078429

#TimeUsernameProblemLanguageResultExecution timeMemory
1078429steveonalexHoliday (IOI14_holiday)C++17
Compilation error
0 ms0 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define ALL(v) (v).begin(), (v).end() #define MASK(i) (1LL << (i)) #define GETBIT(mask, i) (((mask) >> (i)) & 1) mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // mt19937_64 rng(1); ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;} ll max(ll a, ll b){return (a > b) ? a : b;} ll min(ll a, ll b){return (a < b) ? a : b;} ll LASTBIT(ll mask){return mask & (-mask);} ll pop_cnt(ll mask){return __builtin_popcountll(mask);} ll ctz(ll mask){return __builtin_ctzll(mask);} ll clz(ll mask){return __builtin_clzll(mask);} ll logOf(ll mask){return 63 - clz(mask);} template <class T1, class T2> bool minimize(T1 &a, T2 b){ if (a > b){a = b; return true;} return false; } template <class T1, class T2> bool maximize(T1 &a, T2 b){ if (a < b){a = b; return true;} return false; } template <class T> void printArr(T a, string separator = " ", string finish = "\n", ostream& out = cout){ for(auto i: a) out << i << separator; out << finish; } template <class T> void remove_dup(vector<T> &a){ sort(ALL(a)); a.resize(unique(ALL(a)) - a.begin()); } const int LOG_N = 17, N = 1e5 + 69; // modify this int n; int spare_table[LOG_N][N]; vector<int> gen_sa(string s){ int n = s.size(); vector<int> perm(n); for(int i = 0; i<n; ++i) perm[i] = i; vector<int> bruh(n); for(int i = 0; i<n; ++i) bruh[i] = spare_table[0][i] = s[i] - 'a' + 1; for(int j = 1; j < LOG_N; ++j){ vector<ll> cost(n); for(int i = 0; i<n; ++i){ int _i = (i + MASK(j-1)) % n; cost[i] = 1LL * bruh[i] * N + bruh[_i]; } if (j == 1)sort(ALL(perm), [&cost](int x, int y){return cost[x] < cost[y];}); else{ int last = 0; for(int i = 0; i<perm.size(); ++i){ if (i + 1 == perm.size() || bruh[perm[i]] != bruh[perm[i+1]]){ sort(perm.begin() + last, perm.begin() + i + 1, [&cost](int x, int y){return cost[x] < cost[y];}); last = i + 1; } } } int cnt = 0; for(int i = 0; i<n; ++i){ if (i >= 1){ int x = perm[i-1], y = perm[i]; if (cost[x] != cost[y]) cnt++; } bruh[perm[i]] = spare_table[j][perm[i]] = cnt; } } return perm; }

Compilation message (stderr)

holiday.cpp: In function 'std::vector<int> gen_sa(std::string)':
holiday.cpp:69:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |             for(int i = 0; i<perm.size(); ++i){
      |                            ~^~~~~~~~~~~~
holiday.cpp:70:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |                 if (i + 1 == perm.size() || bruh[perm[i]] != bruh[perm[i+1]]){
      |                     ~~~~~~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccL574hD.o: in function `main':
grader.cpp:(.text.startup+0xaf): undefined reference to `findMaxAttraction(int, int, int, int*)'
collect2: error: ld returned 1 exit status