Submission #917960

#TimeUsernameProblemLanguageResultExecution timeMemory
917960406Lozinke (COCI17_lozinke)C++17
100 / 100
254 ms35904 KiB
#include <bits/stdc++.h> #define int int64_t #define FOR(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; using ar = array<int, 2>; const int64_t INF = 1ll << 60; const int N = 2e4 + 5; string s[N]; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<string> V; FOR(i, 0, n) { cin >> s[i]; vector<string> v; FOR(k, 0, s[i].size()) { string a; FOR(j, k, s[i].size()) { a += s[i][j]; v.push_back(a); } } sort(v.begin(), v.end()); v.resize(unique(v.begin(), v.end()) - v.begin()); V.insert(V.end(), v.begin(), v.end()); } sort(V.begin(), V.end()); int ans = -n; FOR(i, 0, n) { int L = lower_bound(V.begin(), V.end(), s[i]) - V.begin(); int R = upper_bound(V.begin(), V.end(), s[i]) - V.begin(); ans += R - L; } cout << ans << '\n'; return 0; }

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:3:42: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
      |                                          ^
lozinke.cpp:21:17: note: in expansion of macro 'FOR'
   21 |                 FOR(k, 0, s[i].size()) {
      |                 ^~~
lozinke.cpp:3:42: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
      |                                          ^
lozinke.cpp:23:25: note: in expansion of macro 'FOR'
   23 |                         FOR(j, k, s[i].size()) {
      |                         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...