# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
201737 | 2020-02-11T21:18:13 Z | mdn2002 | Savez (COCI15_savez) | C++14 | 1000 ms | 23580 KB |
#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; vector<string>s; map<string,vector<int> >mp; map<string,int>dp,on; int n; int f(int x) { if(on[s[x]]!=0)return dp[s[x]]; int ans=0; for(int i=0;i<mp[s[x]].size();i++) { int to=mp[s[x]][i]; if(x>=to)continue; ans=max(ans,f(to)+1); } on[s[x]]++; return dp[s[x]]=ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("empty.in","r",stdin); //freopen("empty.out","w",stdout); cin>>n; for(int k=0;k<n;k++) { string st,pr,sf; cin>>st; for(int i=0,j=st.size()-1;i<st.size();i++,j--) { pr.push_back(st[i]); sf.push_back(st[j]); if(pr==sf)mp[pr].push_back(k); } s.push_back(st); } int ans=0; for(int i=0;i<n;i++)ans=max(ans,f(i)+1); cout<<ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 380 KB | Output is correct |
2 | Incorrect | 5 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Incorrect | 14 ms | 760 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 8824 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 2168 KB | Output is correct |
2 | Execution timed out | 1084 ms | 23580 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1085 ms | 7724 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1087 ms | 8044 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1076 ms | 9212 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1084 ms | 10596 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1058 ms | 15512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1025 ms | 22508 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |