Submission #871353

# Submission time Handle Problem Language Result Execution time Memory
871353 2023-11-10T16:06:47 Z hvmegy Lozinke (COCI17_lozinke) C++17
40 / 100
1000 ms 2136 KB
// [ нvмegy ]
// OLPCHUYENTIN2023 GOTOHUE
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
 
#define int long long
#define all(c) c.begin(), c.end()
#ifdef hvmegy
#define dbg(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
        cerr << "[" << vars << " : ";
        string delim = "";
        (..., (cerr << delim << values, delim = ", "));
        cerr << "]" << '\n'; 
}
#else
#define dbg(...)
#endif
 
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
 
int GOTOHUE();
void init(); 
 
int32_t main()
{
        cin.tie(0) -> sync_with_stdio(0); 
        cout << fixed << setprecision(15);
        
        #ifdef hvmegy
        freopen("input.txt", "r", stdin); 
        freopen("output.txt", "w", stdout); 
        freopen("log.txt", "w", stderr);
        #endif



        // =============================
                bool MULTITEST = 0; 
        // =============================
        
        init(); 
        int OLPCHUYENTIN2023 = 1; 
        if (MULTITEST) cin >> OLPCHUYENTIN2023; 
        for (int i = 1; i <= OLPCHUYENTIN2023; i++) {
                if (GOTOHUE()) break;
                #ifdef hvmegy
                        cout << "--ENDTEST--" << '\n';
                        cerr << "--ENDTEST--" << '\n';
                #endif
        }

        #ifdef hvmegy
                cerr << '\n' << clock() * 1000.0 / CLOCKS_PER_SEC << "ms" << '\n';
        #endif

        return 0;
}

void init() { 
}

int GOTOHUE() { 
        int n; 
        cin >> n; 
        map<string, int> mp; 
        vector<string> s(n + 1); 
        for (int i = 1; i <= n; i++) { 
                cin >> s[i]; 
                mp[s[i]]++; 
        }
        int ans = 0; 
        for (int i = 1; i <= n; i++) { 
                for (int j = 1; j <= n; j++) { 
                        if (i == j) continue; 
                        if (s[i].find(s[j]) != -1) ans++; 
                }
        }
        cout << ans;
        return 0; 
}

Compilation message

lozinke.cpp: In function 'long long int GOTOHUE()':
lozinke.cpp:78:45: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   78 |                         if (s[i].find(s[j]) != -1) ans++;
      |                             ~~~~~~~~~~~~~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 15 ms 348 KB Output is correct
6 Correct 34 ms 608 KB Output is correct
7 Correct 55 ms 600 KB Output is correct
8 Correct 40 ms 600 KB Output is correct
9 Execution timed out 1073 ms 1116 KB Time limit exceeded
10 Execution timed out 1018 ms 1112 KB Time limit exceeded
11 Execution timed out 1063 ms 1628 KB Time limit exceeded
12 Execution timed out 1063 ms 1628 KB Time limit exceeded
13 Execution timed out 1054 ms 1884 KB Time limit exceeded
14 Execution timed out 1036 ms 2136 KB Time limit exceeded
15 Execution timed out 1068 ms 1884 KB Time limit exceeded
16 Execution timed out 1036 ms 1112 KB Time limit exceeded
17 Execution timed out 1041 ms 856 KB Time limit exceeded
18 Execution timed out 1067 ms 860 KB Time limit exceeded
19 Execution timed out 1049 ms 1880 KB Time limit exceeded
20 Execution timed out 1018 ms 1112 KB Time limit exceeded