Submission #80283

# Submission time Handle Problem Language Result Execution time Memory
80283 2018-10-19T18:34:16 Z Genezio Lozinke (COCI17_lozinke) C++14
10 / 100
1000 ms 66560 KB
#include<bits/stdc++.h>

 using namespace std;

 #define pii pair<int,int>
 #define mp make_pair
 #define F first
 #define S second
 #define pb push_back
 #define ll long long

 const int N = 100010;
 const int INF = 0x3f3f3f3f;
 const ll mod = 1e9+7;

 string s;
 map< string,set<int> > m;
 map< string,set<int> > subs;
 map< string,set<int> > f;
 string x;

 int main() {
 	ios::sync_with_stdio(false);
 	cin.tie(0);
    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;i++) {
        cin>>s;
        ans+=subs[s].size();
        //ans+=f[s].size();
        //cout<<i<<" "<<ans<<"\n";
        //f[s].insert(i);
        for(int k=0;k<s.size();k++) {
        	string p=x;
        	for(int j=k;j<s.size();j++) {
        		p+=s[j];
        		ans+=m[p].size();
        		//if(k==0&&j==s.size()-1) continue;
        		subs[p].insert(i);
        		//ans+=f[p].size();
        		//cout<<i<<" "<<k<<" "<<j<<" "<<ans<<"\n";
        	}
        }
        m[s].insert(i);
    }
    cout<<ans<<"\n";
    return 0;
 }

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:34:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int k=0;k<s.size();k++) {
                     ~^~~~~~~~~
lozinke.cpp:36:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          for(int j=k;j<s.size();j++) {
                      ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 508 KB Output isn't correct
3 Incorrect 3 ms 736 KB Output isn't correct
4 Incorrect 4 ms 736 KB Output isn't correct
5 Incorrect 19 ms 2652 KB Output isn't correct
6 Incorrect 36 ms 3448 KB Output isn't correct
7 Incorrect 48 ms 5912 KB Output isn't correct
8 Correct 87 ms 9752 KB Output is correct
9 Incorrect 260 ms 15640 KB Output isn't correct
10 Correct 562 ms 37896 KB Output is correct
11 Incorrect 460 ms 37896 KB Output isn't correct
12 Runtime error 827 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Runtime error 861 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
14 Runtime error 943 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
15 Execution timed out 1016 ms 66560 KB Time limit exceeded
16 Runtime error 837 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
17 Runtime error 194 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
18 Runtime error 120 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
19 Runtime error 971 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
20 Runtime error 388 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.