Submission #370646

# Submission time Handle Problem Language Result Execution time Memory
370646 2021-02-24T11:13:13 Z FatihSolak Rima (COCI17_rima) C++17
14 / 140
1000 ms 77220 KB
#include <bits/stdc++.h>
#define N 500005
using namespace std;
string s[N];
unordered_map<string,int> mp;
unordered_map<string,int> mp2;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> s[i];
		string t = s[i];
		reverse(t.begin(), t.end());
		mp[t]++;
		t.pop_back();
		mp2[t]++;
	}
	int ans = 0;
	assert(n > 18);
	for(int i=0;i<n;i++){
		string c = s[i];
		reverse(c.begin(), c.end());
		string t = c;
		c.pop_back();
		int sum = 0;
		while(t.size()){
			sum += mp2[c];
			c.pop_back();
			t.pop_back();
			if(!mp[t]){
				break;
			}
		}
		ans = max(ans,sum);
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 32236 KB Execution killed with signal 6
2 Runtime error 30 ms 32236 KB Execution killed with signal 6
3 Runtime error 31 ms 32236 KB Execution killed with signal 6
4 Execution timed out 1098 ms 77220 KB Time limit exceeded
5 Correct 446 ms 25344 KB Output is correct
6 Incorrect 21 ms 18652 KB Output isn't correct
7 Incorrect 19 ms 18408 KB Output isn't correct
8 Incorrect 19 ms 18340 KB Output isn't correct
9 Incorrect 100 ms 26016 KB Output isn't correct
10 Incorrect 23 ms 18252 KB Output isn't correct