Submission #472765

# Submission time Handle Problem Language Result Execution time Memory
472765 2021-09-14T09:55:30 Z Mr_Ph Lozinke (COCI17_lozinke) C++14
0 / 100
1000 ms 888 KB
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
bool cmp(const string &a,const string &b)
{
    return a.sz<b.sz;
}
void solve()
{
    int n;
    cin>>n;
    vector<string>arr(n);
    ent(arr);
   // sort(all(arr),cmp);
    ll cnt=0;
    for(int i=0; i<n; i++)
    {
        string c;
        bool valid=false;
        //cout<<arr[i]<<endl;
        ll mx=0;
        ll temp=0;
        map<string,int>mp;
        for(int k=0; k<arr[i].sz; k++)
        {
            for(int e=1; e<=arr[i].sz; e++)
            {
                c=arr[i].substr(k,e);
               // cout<<c<<endl;
                for(int w=0; w<n; w++)
                {
                    if(w==i)
                        continue;
                    //cout<<arr[w]<<" "<<c<<endl;
                    if(arr[w]==c&&!mp[arr[w]])
                    {
                        temp++;
                        mp[arr[w]]++;
                      //  cout<<arr[w]<<" "<<c<<endl;
                    }
                }
              //  if(temp)
               //     cout<<temp<<endl;
            }
        }
        cnt+=temp;
    }
    cout<<cnt<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    //freopen("window.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;//int st;
    //cin>>t;//cin>>st;
    while(t--)
        solve();
}

Compilation message

lozinke.cpp: In function 'void solve()':
lozinke.cpp:18:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | #define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
      |                              ~^~~~~~~~~~~
lozinke.cpp:32:5: note: in expansion of macro 'ent'
   32 |     ent(arr);
      |     ^~~
lozinke.cpp:43:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for(int k=0; k<arr[i].sz; k++)
      |                       ^
lozinke.cpp:45:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |             for(int e=1; e<=arr[i].sz; e++)
      |                           ^
lozinke.cpp:38:14: warning: unused variable 'valid' [-Wunused-variable]
   38 |         bool valid=false;
      |              ^~~~~
lozinke.cpp:40:12: warning: unused variable 'mx' [-Wunused-variable]
   40 |         ll mx=0;
      |            ^~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 2 ms 204 KB Output isn't correct
4 Incorrect 10 ms 204 KB Output isn't correct
5 Incorrect 114 ms 332 KB Output isn't correct
6 Incorrect 228 ms 352 KB Output isn't correct
7 Incorrect 411 ms 456 KB Output isn't correct
8 Incorrect 395 ms 332 KB Output isn't correct
9 Execution timed out 1091 ms 588 KB Time limit exceeded
10 Execution timed out 1096 ms 588 KB Time limit exceeded
11 Execution timed out 1093 ms 716 KB Time limit exceeded
12 Execution timed out 1093 ms 716 KB Time limit exceeded
13 Execution timed out 1095 ms 844 KB Time limit exceeded
14 Execution timed out 1069 ms 844 KB Time limit exceeded
15 Execution timed out 1083 ms 844 KB Time limit exceeded
16 Execution timed out 1094 ms 844 KB Time limit exceeded
17 Execution timed out 1096 ms 844 KB Time limit exceeded
18 Execution timed out 1092 ms 844 KB Time limit exceeded
19 Execution timed out 1080 ms 844 KB Time limit exceeded
20 Execution timed out 1093 ms 888 KB Time limit exceeded